Created
March 14, 2019 15:46
-
-
Save EspaceRaspberryFrancais/b8802f4a7e91295943d5a236a819923f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define Rouge A0 | |
#define Vert A1 | |
#define Bleu A2 | |
int message = 0; | |
int couleurs[] = {Rouge, Vert, Bleu}; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(Rouge, OUTPUT); | |
pinMode(Vert, OUTPUT); | |
pinMode(Bleu, OUTPUT); | |
} | |
void loop() { | |
if (Serial.available()) { | |
message = Serial.read() - '0'; | |
if (message > 3) { | |
digitalWrite(couleurs[message-4], LOW); | |
} | |
else { | |
digitalWrite(couleurs[message-1], HIGH); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment