#led on ,off using resistor and switch(Pull up)
from machine import Pin
import time
led_pin = 2
switch_pin = 14
led = Pin(led_pin, Pin.OUT)
switch = Pin(switch_pin, Pin.IN)
while True:
switch_state = switch.value()
if (switch_state == True):
led.on()
time.sleep(0.1)
else:
led.off()