#internal pull down
import machine
import time
led = machine.Pin(2, machine.Pin.OUT)
switch = machine.Pin(14, machine.Pin.IN, machine.Pin.PULL_DOWN)
while True:
if switch.value() == 1:
led.on()
time.sleep(0.1)
else:
led.off()
time.sleep(0.1)