from machine import Pin
import time

red_pin = machine.Pin(22, machine.Pin.OUT)
blue_pin = machine.Pin(28, machine.Pin.OUT)
green_pin = machine.Pin(27, machine.Pin.OUT)

button_green = machine.Pin(16,machine.Pin.IN, machine.Pin.PULL_UP)
button_blue = machine.Pin(17,machine.Pin.IN, machine.Pin.PULL_UP)

flag1=False 
flag2=False
count=0

while True: 

    if button_green.value()==1 and button_blue.value()==1:
        flag1=True
      
    if  button_green.value()==0 and button_blue.value()==1 and flag1==True:
        count=(count+1)%4
        flag1=False
    if button_green.value()==1 and button_blue.value()==1:
        flag2=True
    if button_blue.value()==0 and button_green.value()==1 and flag2==True:
        count=(count-1)%4
        flag2=False
    if count>3 :
        count=1
    if count<1:
        count=3
    if count==3:
      red_pin.off()
      green_pin.on()
      blue_pin.on()
    if count==2:
      red_pin.on()
      green_pin.off()
      blue_pin.on()
    if count==1:
      red_pin.on()
      green_pin.on()
      blue_pin.off()
    print(count)
    time.sleep(0.5)






       
        
    
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT