from picozero import LED, Button, RGBLED
from time import sleep
rgb = RGBLED(red = 0 , green = 1, blue = 2)
button = Button(8)
Value = 0
red = (255,0,0)
purple = (255,0,255)
blue = (0,0,255)
cyan = (0, 255, 255)
green = (0,255,0)
yellow = (255,255,0)
white = (255,255,255)
colors = [red, purple, blue, cyan, green, yellow, white]
Press = False
while True:
if(button.is_pressed):
Press = True
Value = Value + 1
if Value == 7:
Value = 0
rgb.color = colors[Value]
else:
if Press == True:
if rgb.on():
rgb.off()
else:
rgb.on
Press = False