from machine import Pin
import time
# Initialize the LED and button pins
led = Pin(19, Pin.OUT)
button = Pin(20, Pin.IN, Pin.PULL_UP)
print("")
while True:
if not button.value(): # Check if button is pressed
led.on() # Turn on the LED
print("Button pressed. Turning on the light.")
else:
led.off() # Turn off the LED
print("Button released. Turning off the light.")
time.sleep(1) # Debounce delay