miklik

edPy-otaceniZaSvetlem

Jan 27th, 2020
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import Ed
  2.  
  3. Ed.EdisonVersion = Ed.V2
  4.  
  5. Ed.DistanceUnits = Ed.CM
  6. Ed.Tempo = Ed.TEMPO_MEDIUM
  7.  
  8. #--------Your code below-----------
  9.  
  10. while 1:
  11.     L = Ed.ReadLeftLightLevel()
  12.     R = Ed.ReadRightLightLevel()
  13.     while abs(L - R) > 100:
  14.         if L > R:
  15.             Ed.Drive(Ed.SPIN_LEFT, 3, 10)
  16.         else:
  17.             Ed.Drive(Ed.SPIN_RIGHT, 3, 10)
  18.         Ed.TimeWait(50, Ed.TIME_MILLISECONDS)
  19.         L = Ed.ReadLeftLightLevel()
  20.         R = Ed.ReadRightLightLevel()
Advertisement
Add Comment
Please, Sign In to add comment