Join ISRs

This commit is contained in:
cryptogopher
2022-10-09 14:40:33 +02:00
parent b81b52b204
commit 3872ece37b

View File

@@ -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() {}