#control led using external pullup
from machine import Pin
from time import sleep
led=Pin(22,Pin.OUT)
switch=Pin(5,Pin.IN)
while True:
x=switch.value()
if x==0:
led.value(1)
else:
led.value(0)
#control led using external pullup
from machine import Pin
from time import sleep
led=Pin(22,Pin.OUT)
switch=Pin(5,Pin.IN)
while True:
x=switch.value()
if x==0:
led.value(1)
else:
led.value(0)