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