# # Jay Summet # CS 1301c # Released to the public domain may 2007 # Orients the robot towards the brightest light it can see for 25 seconds. # If your forward and backward on the robot are reversed, you may have to # reverse the turnLeft and turnRight movement calls. from myro import * initialize() time_to_run = 25 start_time = currentTime() #Note that you could also use # while ( timeRemaining(25) ): while (start_time + time_to_run > currentTime() ) : left_light = getLight("left") right_light = getLight("right") center_light = getLight("center") if ( (center_light < right_light) and ( center_light < left_light ) ): wait(0.5) elif(left_light < right_light): turnLeft(0.5,0.25) else: turnRight(0.5,0.25) print "Program Done"