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)