from machine import Pin
from time import sleep
LED = Pin(15, Pin.OUT) # creating LED object, setting it as OUT
BACK_BUTTON = Pin(22, Pin.IN) # creating Push Button object, setting it as IN
SCROLL_BUTTON = Pin(21, Pin.IN) # creating Push Button object, setting it as IN
ENTER_BUTTON = Pin(20, Pin.IN) # creating Push Button object, setting it as IN
MENU_MODE = False
# 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 ENTER_BUTTON.value() == 1:
LED.on()
print("this works")
# sleep(0.1)
sleep(0.2) # Debounce delay
# otherwise, turn the LED off
else:
LED.off()