from machine import Pin
from time import *
print('hello ESP32!')
D1 = 3
D8 = 8
led = Pin(D1, Pin.OUT)
btn = Pin(D8, Pin.IN, Pin.PULL_UP)
while True:
print('btn =', btn.value())
if btn.value():
led.off()
else:
led.on()
sleep_ms(100)Loading
xiao-esp32-c3
xiao-esp32-c3