from machine import Pin
from utime import sleep
r = Pin(10, Pin.OUT)
g = Pin(9, Pin.OUT)
b = Pin(8, Pin.OUT)
led = (r, g, b)
def set_led(color: str = ""):
if color == "r":
r.on()
g.off()
b.off()
elif color == "g":
g.on()
r.off()
b.off()
elif color == "b":
b.on()
r.off()
g.off()
else:
for i in led:
i.toggle()
while True:
set_led("r")
sleep(1.5)
set_led("g")
sleep(1.5)
set_led("b")
sleep(1.5)