# Play a note to let us know you're alive! bot.playNote('A4', 100) #while True: # Tell the Create2 to turn CCW slowly #bot.setTurnSpeed(-50) # Wait a second allows turn of 180 #time.sleep(7.13) # Stop #bot.setTurnSpeed(0) #FWD bot.direct(30, 30) #recieve sensor data and stop at black line < 2000 timer = 0 rightsensor = 2000 leftsensor = 2000 while rightsensor >= 2000 and leftsensor >= 2000: bot._get_sensor_packet() leftsensor = bot.robot.sensor_state['cliff front left signal'] rightsensor = bot.robot.sensor_state['cliff front right signal'] time.sleep(0.015) # Wait a second #time.sleep(1) #Stop direct
while True: try: val = hx.get_weight(17) if val >= 100000: time.sleep(1) if val >= 100000: break else: print("Waiting...") except (KeyboardInterrupt, SystemExit): cleanAndExit() bot.safe() bot.direct(-100, -100) time.sleep(0.5) bot.direct(0, 0) time.sleep(0.25) while True: IO.output(22, 0) IO.output(23, 0) IO.output(24, 0) if (IO.input(5) == True): #LL IR senses tape array[0] = 1 if (IO.input(5) == False): #LL IR does not sense tape array[0] = 0 IO.output(22, 1)