Join ISRs
This commit is contained in:
12
metronom.ino
12
metronom.ino
@@ -25,21 +25,17 @@ void setup() {
|
|||||||
initButton();
|
initButton();
|
||||||
|
|
||||||
ITimer.attachInterruptInterval_MS(10, TimerHandler);
|
ITimer.attachInterruptInterval_MS(10, TimerHandler);
|
||||||
ISR_Timer.setInterval(PERIOD_MS, metronomeBeat);
|
ISR_Timer.setInterval(PERIOD_MS, metronomeRun);
|
||||||
ISR_Timer.setInterval(PERIOD_MS, metronomeCountdown);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void metronomeCountdown() {
|
void metronomeRun() {
|
||||||
if (countdown > 0) {
|
if (countdown > 0) {
|
||||||
countdown -= 1;
|
countdown -= 1;
|
||||||
|
|
||||||
digitalWrite(BUTTON_LED_PIN, countdown % 2 ? HIGH : LOW);
|
digitalWrite(BUTTON_LED_PIN, countdown % 2 ? HIGH : LOW);
|
||||||
|
} else if (countdown == 0) {
|
||||||
|
//tone(BUZZER_PIN, 1000, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void metronomeBeat() {
|
|
||||||
if (countdown == 0)
|
|
||||||
tone(BUZZER_PIN, 1000, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {}
|
void loop() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user