from machine import Pin
from time import sleep
LED = Pin(15, Pin.OUT) # creating LED object, setting it as OUT
BUTTON = Pin(16, Pin.IN) # creating Push Button object, setting it as IN
# continuously read the signal from the push button while the board has power
while True:
# if the signal from the button is HIGH (button is pressed), turn LED on
if BUTTON.value() == 1:
LED.on()
sleep(0.1)
# otherwise, turn the LED off
else:
LED.off()