Skip to content

Instantly share code, notes, and snippets.

@EspaceRaspberryFrancais
Created March 14, 2019 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EspaceRaspberryFrancais/b8802f4a7e91295943d5a236a819923f to your computer and use it in GitHub Desktop.
Save EspaceRaspberryFrancais/b8802f4a7e91295943d5a236a819923f to your computer and use it in GitHub Desktop.
#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