from machine import Pin
import time
led_pin = 2 # Define LED GPIO pin (int)
button_pin = 0 # Define button GPIO pin (int)
led = Pin(led_pin, Pin.OUT)
button = Pin(button_pin, Pin.IN, Pin.PULL_UP)
while True:
if button.value() == 0: # Button pressed (active low)
led.on() # Turn on the LED
else:
led.off() # Turn off the LED
time.sleep(0.1) # Debounce delay