1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| int bouton1 = LOW;
int boutonALT1 = LOW;
int bouton2 = LOW;
int boutonALT2 = LOW;
void setup(){
Serial.begin(115200);
pinMode(22, INPUT);
pinMode(23, INPUT);
}
void loop(){
bouton1 = digitalRead(22);
if(bouton1 == HIGH &&boutonALT1 == LOW) {
Serial.write(144);
Serial.write(17);
Serial.write(127);
boutonALT1 = bouton1;
}
if(bouton1 == LOW && boutonALT1 == HIGH){
Serial.write(144);
Serial.write(17);
Serial.write(0);
boutonALT1 = bouton1;
}
bouton2 = digitalRead(23);
if(bouton2 == HIGH &&boutonALT2 == LOW) {
Serial.write(145);
Serial.write(18);
Serial.write(127);
boutonALT2 = bouton2;
}
if(bouton2 == LOW && boutonALT2 == HIGH){
Serial.write(145);
Serial.write(18);
Serial.write(0);
boutonALT2 = bouton2;
}
} |
Partager