import time import board import digitalio import usb_hid from adafruit_hid.mouse import Mouse btn = digitalio.DigitalInOut(board.GP5) btn.direction = digitalio.Direction.INPUT btn.pull = digitalio.Pull.UP led = digitalio.DigitalInOut(board.GP0) led.direction = digitalio.Direction.OUTPUT mouse = Mouse(usb_hid.devices) while True: button_state = btn.value if button_state == False: led.value = False mouse.move(50,0) else: led.value = True time.sleep(0.085) # this is effectively the polling rate for this