You are on page 1of 3

Edison Around The School

Ed.TimeWait(5, Ed.TIME_SECONDS)
Ed.Drive(Ed.FORWARD, Ed.SPEED_5, 68)
Ed.Drive(Ed.SPIN_RIGHT, 3, 87)
Ed.Drive(Ed.FORWARD, Ed.SPEED_3, 20)
Ed.Drive(Ed.SPIN_RIGHT, 3, 87)
Ed.Drive(Ed.FORWARD, Ed.SPEED_3, 15)
Ed.Drive(Ed.STOP, Ed.SPEED_3, 1)
Ed.PlayBeep()
Ed.TimeWait(5, Ed.TIME_SECONDS)
Ed.Drive(Ed.FORWARD, Ed.SPEED_3, 50)
Ed.Drive(Ed.SPIN_LEFT, 3, 96)
Ed.Drive(Ed.FORWARD, Ed.SPEED_3, 32)
Ed.Drive(Ed.SPIN_LEFT, 3, 90)
Ed.Drive(Ed.FORWARD, Ed.SPEED_3, 22)
Ed.Drive(Ed.STOP, Ed.SPEED_3, 1)

Edison Chain Reaction


Ed.ReadIRData()

while True:
data = Ed.ReadIRData()
if data == 11:
Ed.Drive(Ed.SPIN_LEFT, 5, 90)
Ed.PlayBeep()
Ed.Drive(Ed.SPIN_RIGHT, 5, 90)
Ed.TimeWait(500, Ed.TIME_MILLISECONDS)
Ed.SendIRData(22)

Edison Line Tracking


line tracking
import Ed

Ed.EdisonVersion = Ed.V2

Ed.DistanceUnits = Ed.CM
Ed.Tempo = Ed.TEMPO_MEDIUM

#--------Your code below-----------

Ed.LineTrackerLed(Ed.ON)

Ed.SetDistance(Ed.MOTOR_LEFT,5)
while True:
if Ed.ReadLineState()==Ed.LINE_ON_WHITE:
Ed.Drive(Ed.FORWARD_RIGHT, Ed.SPEED_1, Ed.DISTANCE_UNLIMITED)
else:
Ed.Drive(Ed.FORWARD_LEFT, Ed.SPEED_1, Ed.DISTANCE_UNLIMITED)

if Ed.ReadLeftLightLevel() < 55:


Ed.LeftLed(Ed.ON)
else:
Ed.LeftLed(Ed.OFF)

if Ed.ReadRightLightLevel()<55 :
Ed.RightLed(Ed.ON)
else:
Ed.RightLed(Ed.OFF)

if Ed.ReadDistance(Ed.MOTOR_LEFT) == 0:
Ed.LeftLed(Ed.ON)
Ed.RightLed(Ed.ON)
Ed.TimeWait(Ed.TIME_MILLISECONDS, 500)
Ed.PlayBeep()
Ed.LeftLed(Ed.OFF)
Ed.RightLed(Ed.OFF)
Ed.SetDistance(Ed.MOTOR_LEFT, 50)

Edison Boy Band


Ed.ReadIRData()

while True:
data = Ed.ReadIRData()

if data == 22:
Ed.Drive(Ed.FORWARD, Ed.SPEED_5, 10)
Ed.Drive(Ed.BACKWARD, Ed.SPEED_5, 10)
Ed.TimeWait(500, Ed.TIME_MILLISECONDS)

if data == 33:
Ed.Drive(Ed.BACKWARD, Ed.SPEED_5, 10)
Ed.Drive(Ed.FORWARD, Ed.SPEED_5, 10)
Ed.TimeWait(500, Ed.TIME_MILLISECONDS)

if data == 44:
Ed.Drive(Ed.SPIN_LEFT, 5, 90)
Ed.Drive(Ed.SPIN_RIGHT, 5, 180)
Ed.TimeWait(500, Ed.TIME_MILLISECONDS)

if data == 55:
Ed.Drive(Ed.SPIN_RIGHT, 5, 90)
Ed.Drive(Ed.SPIN_LEFT, 5, 180)
Ed.TimeWait(500, Ed.TIME_MILLISECONDS)

if data == 66:
Ed.Drive(Ed.SPIN_LEFT, 5, 360)
Ed.TimeWait(500, Ed.TIME_MILLISECONDS)

if data == 77:
Ed.LeftLed(Ed.ON)
Ed.RightLed(Ed.ON)
Ed.TimeWait(500, Ed.TIME_MILLISECONDS)
Ed.LeftLed(Ed.OFF)
Ed.RightLed(Ed.OFF)
Ed.TimeWait(500, Ed.TIME_MILLISECONDS)

if data == 88:
Ed.Drive(Ed.SPIN_LEFT, 5, 90)
Ed.Drive(Ed.SPIN_RIGHT, 5, 180)
Ed.Drive(Ed.SPIN_LEFT, 5, 90)

Related Interests