# write a micropython script to control the onboard led with respect to the position of onboard key or pushbutton (whenever the key is on led should be on)
import machine
import time
button = machine.Pin(0, machine.Pin.IN, machine.Pin.PULL_UP)
led = machine.Pin(2, machine.Pin.OUT)
while True:
button_state = button.value()
if button_state == 0:
led.value(1)
else:
led.value(0)
time.sleep(0.1)