#Led using switch
from machine import Pin
from time import sleep
led=Pin(18,Pin.OUT)
switch=Pin(0,Pin.IN)
while True:
x=switch.value()
if x==1:
led.on()
else:
led.off()
#Led using switch
from machine import Pin
from time import sleep
led=Pin(18,Pin.OUT)
switch=Pin(0,Pin.IN)
while True:
x=switch.value()
if x==1:
led.on()
else:
led.off()