#need help with this code
4 messages · Page 1 of 1 (latest)
wher code
I’ll send it in tomorrow cause my code is on my pc
while True:
brain.screen.clear_screen()
brain.screen.set_cursor(1,1)
cup.spin(FORWARD)
cup.set_velocity(10, PERCENT)
gear.set_position(0, DEGREES)
spinner.set_velocity(10, PERCENT)
spinner.spin_for(REVERSE, 90, DEGREES)
wait(2.8, SECONDS)
midpoint = (-45 + 55) / 2
optical_10.set_light(LedStateType.ON)
if optical_10.is_near_object() == 1:
if optical_10.hue() > -30 and optical_10.hue() < 30: #red
servo_h.set_position(110, DEGREES)
gear.spin_to_position(90, DEGREES)
wait(.5, SECONDS)
gear.spin_to_position(-90, DEGREES)
elif optical_10.hue() > 210 and optical_10.hue() < 270: #blue
servo_h.set_position(110, DEGREES)
gear.spin_to_position(120, DEGREES)
wait(.01, SECONDS)
gear.spin_to_position(-120, DEGREES)
else:
servo_h.set_position(midpoint, DEGREES)
gear.set_position(0, DEGREES)
wait(.1, SECONDS)