const int rouge1Pin = 2; // Broche pour la LED rouge du feu 1
const int orange1Pin = 3; // Broche pour la LED orange du feu 1
const int vert1Pin = 4; // Broche pour la LED verte du feu 1
const int rouge2Pin = 5; // Broche pour la LED rouge du feu 2
const int orange2Pin = 6; // Broche pour la LED orange du feu 2
const int vert2Pin = 7; // Broche pour la LED verte du feu 2
const int tempsRouge = 5000; // Temps en millisecondes pour le feu rouge
const int tempsOrange = 1000; // Temps en millisecondes pour le feu orange
const int tempsVert = 5000; // Temps en millisecondes pour le feu vert
void setup() {
// Initialisation des broches en sortie
pinMode(rouge1Pin, OUTPUT);
pinMode(orange1Pin, OUTPUT);
pinMode(vert1Pin, OUTPUT);
pinMode(rouge2Pin, OUTPUT);
pinMode(orange2Pin, OUTPUT);
pinMode(vert2Pin, OUTPUT);
}
void loop() {
// Cycle des feux pour 6 transitions d'états
for (int i = 0; i < 6; i++) {
// Feu 1 : Rouge
digitalWrite(rouge1Pin, HIGH);
digitalWrite(orange1Pin, LOW);
digitalWrite(vert1Pin, LOW);
// Feu 2 : Vert
digitalWrite(rouge2Pin, LOW);
digitalWrite(orange2Pin, LOW);
digitalWrite(vert2Pin, HIGH);
delay(tempsRouge);
// Feu 1 : Orange
digitalWrite(rouge1Pin, LOW);
digitalWrite(orange1Pin, HIGH);
digitalWrite(vert1Pin, LOW);
// Feu 2 : Orange
digitalWrite(rouge2Pin, LOW);
digitalWrite(orange2Pin, HIGH);
digitalWrite(vert2Pin, LOW);
delay(tempsOrange);
// Feu 1 : Vert
digitalWrite(rouge1Pin, LOW);
digitalWrite(orange1Pin, LOW);
digitalWrite(vert1Pin, HIGH);
// Feu 2 : Rouge
digitalWrite(rouge2Pin, HIGH);
digitalWrite(orange2Pin, LOW);
digitalWrite(vert2Pin, LOW);
delay(tempsVert);
}
}