gestion bp pour changement d'annimation

master
jblb 4 years ago
parent 355bc04387
commit 992c2dbb78

@ -66,15 +66,20 @@ void xmas(uint8_t wait){
delay(wait);
}
}
// change run_mod retur true si appuis cour
boolean check_button(){
if (button1.checkPress() == 1) {
run_mod = true; // Serial.println("SHORT PRESS!");
// SHORT PRESS!
if (!run_mod){
run_mod = true;
}
return true;
} else if (button1.checkPress() == -1) {
// LONG PRESS!
black_out();
run_mod = false;
// Serial.println("LONG PRESS!");
return false;
}
return run_mod;
}
void setup()
@ -94,24 +99,25 @@ if (run_mod){
delay(tempo_anim);
colorWipe_up(CRGB::Green, tempo_anim);
delay(tempo_anim);
if (!check_button()) break;
if (breaked) break;
if (check_button()) break;
}
}
if (run_mod) {
for (int i = 0; i < 5; i++) {
dual_color(CRGB::Red, CRGB::Green, tempo_anim);
if (!check_button()) break;
if (check_button()) break;
}
}
if (run_mod){
for (int i = 0; i < 20; i++) {
xmas( tempo_anim);
if (!check_button()) break;
if (check_button()) break;
}
}
check_button();
black_out();
delay(tempo_anim);
// delay(tempo_anim);
}

Loading…
Cancel
Save