import time
time.sleep(0.1) # Wait for USB to become ready
from machine import Pin
BUTTON = Pin(16, Pin.IN)
LED = Pin(18, Pin.OUT)
while True:
state = BUTTON.value()
if state == 1:
LED.value(1)
else:
LED.value(0)
time.sleep(0.01)