Projet

Général

Profil

Deuxième semaine » script2_arduino.ino

Thomas-Alexandre Moreau, 20/01/2025 14:47

 
// ORDER -> RED - BLUE - GREEN

int RED = 11;
int GREEN = 10;
int BLUE = 9;

void setup() {
pinMode(RED, OUTPUT);
pinMode(GREEN, OUTPUT);
pinMode(BLUE, OUTPUT);
}

void loop() {
blink_red(500);
blink_blue(500);
blink_green(500);
}

void blink_red(int delay_value) {
digitalWrite(RED, HIGH);
// digitalWrite(GREEN, LOW);
// digitalWrite(BLUE, LOW);
delay(delay_value);
digitalWrite(RED, LOW);
// digitalWrite(GREEN, LOW);
// digitalWrite(BLUE, LOW);
delay(delay_value);
}

void blink_green(int delay_value) {
// digitalWrite(RED, LOW);
digitalWrite(GREEN, HIGH);
// digitalWrite(BLUE, LOW);
delay(delay_value);
// digitalWrite(RED, LOW);
digitalWrite(GREEN, LOW);
// digitalWrite(BLUE, LOW);
delay(delay_value);
}

void blink_blue(int delay_value) {
// digitalWrite(RED, LOW);
// digitalWrite(GREEN, LOW);
digitalWrite(BLUE, HIGH);
delay(delay_value);
// digitalWrite(RED, LOW);
// digitalWrite(GREEN, LOW);
digitalWrite(BLUE, LOW);
delay(delay_value);
}
(1-1/7)