from machine import Pin
from time import sleep
#Définition des PIN
BP_Compteur = Pin(28, Pin.IN, Pin.PULL_UP)
BP_Stop = Pin(27, Pin.IN, Pin.PULL_UP)
LED_Rouge = Pin(2, Pin.OUT)
LED_Vert = Pin(3, Pin.OUT)
LED_Bleu = Pin(4, Pin.OUT)
print("hello")
LED_Rouge.value(0)
LED_Vert.value(0)
LED_Bleu.value(0)
BP_NB = 0
def Stop(BP,Rouge,Vert,Bleu):
BP = 0
Rouge.value(0)
Vert.value(0)
Bleu.value(0)
return BP
def Change_LED(BP,Rouge,Vert,Bleu):
B = True
if BP == 0 and B:
Rouge.value(1)
Vert.value(0)
Bleu.value(0)
print("Led Rouge")
B = False
if BP == 1 and B:
Rouge.value(0)
Vert.value(1)
Bleu.value(0)
print("Led Vert")
B = False
if BP == 2 and B:
Rouge.value(0)
Vert.value(0)
Bleu.value(1)
print("Led bleu")
B = False
BP += 1
print(BP)
sleep(0.15)
if BP == 3:
BP = 0
return BP
while 1:
NB = Stop(BP_NB,LED_Rouge,LED_Vert,LED_Bleu)
while BP_Stop.value() == 1:
BP_NB = NB
if BP_Compteur.value() == 0:
NB = Change_LED(BP_NB,LED_Rouge,LED_Vert,LED_Bleu)
pico:GP0
pico:GP1
pico:GND.1
pico:GP2
pico:GP3
pico:GP4
pico:GP5
pico:GND.2
pico:GP6
pico:GP7
pico:GP8
pico:GP9
pico:GND.3
pico:GP10
pico:GP11
pico:GP12
pico:GP13
pico:GND.4
pico:GP14
pico:GP15
pico:GP16
pico:GP17
pico:GND.5
pico:GP18
pico:GP19
pico:GP20
pico:GP21
pico:GND.6
pico:GP22
pico:RUN
pico:GP26
pico:GP27
pico:GND.7
pico:GP28
pico:ADC_VREF
pico:3V3
pico:3V3_EN
pico:GND.8
pico:VSYS
pico:VBUS
rgb1:R
rgb1:COM
rgb1:G
rgb1:B
r1:1
r1:2
r2:1
r2:2
r3:1
r3:2
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
btn2:1.l
btn2:2.l
btn2:1.r
btn2:2.r