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