from machine import Pin
import time
btn=Pin(3, Pin.IN, Pin.PULL_UP)
r=Pin(10, Pin.OUT)
g=Pin(11, Pin.OUT)
b=Pin(12, Pin.OUT)
COLORS = [
(1,0,0),
(0,1,0),
(0,0,1),
(1,1,0),
(1,1,1),
(0,0,0),
]
index=0
def show(rgb):
r.value(rgb[0])
g.value(rgb[1])
b.value(rgb[2])
show(COLORS[index])
while True:
if btn.value()==0:
index=(index+1)%len(COLORS)
show(COLORS[index])
print(index)
time.sleep(0.3)
time.sleep(0.02)