from machine import Pin
import time
# Define the LED pin
ledR = Pin(4, Pin.OUT) # Use correct gpio
ledG = Pin(5, Pin.OUT) # Use correct gpio
ledB = Pin(6, Pin.OUT) # Use correct gpio
buttonR = Pin(10, mode=Pin.IN, pull=Pin.PULL_UP)
buttonG = Pin(9, mode=Pin.IN, pull=Pin.PULL_UP)
buttonB = Pin(8, mode=Pin.IN, pull=Pin.PULL_UP)
# Blink the LED in a loop
while True:
ledR.value(not buttonR.value()) # Turn the LEDR depend on inputR
ledG.value(not buttonG.value()) # Turn the LEDG depend on inputG
ledB.value(not buttonB.value()) # Turn the LEDB depend on inputB
Loading
xiao-esp32-c3
xiao-esp32-c3