#Internal pullup.
from machine import Pin
led=Pin(2,Pin.OUT)
switch=Pin(14,Pin.IN,Pin.PULL_UP)
while True:
if switch.value()==0:
led.on()
else:
led.off()
Loading
esp32-devkit-c-v4
esp32-devkit-c-v4
#Internal pullup.
from machine import Pin
led=Pin(2,Pin.OUT)
switch=Pin(14,Pin.IN,Pin.PULL_UP)
while True:
if switch.value()==0:
led.on()
else:
led.off()