from machine import Pin
import time as t

# Define the pin connected to the LED and the switch

switch_pin = Pin(14, Pin.IN)

  # Variable to store the current state of the LED

while True:
    switch_state = switch_pin.value()
    if switch_state == 1:  # If the switch is pressed
        print("pressed")  # Set the LED state
    else:
        print("not pressed") # Adjust sleep time as needed
    t.sleep(0.1)  # Adjust sleep time as needed for responsiveness