def choose_motor_loop(): """ while the back button is not pressed loop and set the active motor to control based on the button pressed. """ btn = Button() btn.on_change = change_motor while True: btn.process() sleep(0.01)
done = True if ("up", True) in changed_buttons: choice -= 1 if choice < 0: choice = len(progs) - 1 elif ("down", True) in changed_buttons: choice += 1 if choice >= len(progs): choice = 0 logging.info('Done is: ' + str(done)) # will also beep if release button s.beep() # Set callback from b.process() b.on_change = change def run_program(): # This loop checks button states # continuously and calls appropriate event handlers global done global wait_for done = False wait_for = ("enter", True) logging.info("Waiting for enter button.") while not done: #ang = gyro.angle ang = 0 rli_left = color_left.reflected_light_intensity rli_right = color_right.reflected_light_intensity