Move tube to separate file
This commit is contained in:
22
metronom.ino
22
metronom.ino
@@ -1,6 +1,5 @@
|
||||
#include "SAMDTimerInterrupt.h"
|
||||
#include "SAMD_ISR_Timer.h"
|
||||
#include "grove_alphanumeric_display.h"
|
||||
|
||||
#define HW_TIMER_INTERVAL_MS 10
|
||||
SAMDTimer ITimer(TIMER_TC3);
|
||||
@@ -8,7 +7,6 @@ SAMD_ISR_Timer ISR_Timer;
|
||||
|
||||
void TimerHandler(void) { ISR_Timer.run(); }
|
||||
|
||||
Seeed_Digital_Tube tube;
|
||||
|
||||
const int COUNTDOWN = 240;
|
||||
const int PERIOD_MS = 1000;
|
||||
@@ -28,12 +26,7 @@ volatile float temperature = 0.0;
|
||||
void setup() {
|
||||
initButton();
|
||||
initTemperature();
|
||||
|
||||
// Wire initialized by temperature sensor
|
||||
tube.setTubeType(TYPE_4, TYPE_4_DEFAULT_I2C_ADDR);
|
||||
tube.setBrightness(15);
|
||||
tube.setBlinkRate(BLINK_OFF);
|
||||
tube.setPoint(true,true);
|
||||
initTube();
|
||||
|
||||
ITimer.attachInterruptInterval_MS(10, TimerHandler);
|
||||
ISR_Timer.setInterval(PERIOD_MS, runMetronome);
|
||||
@@ -47,19 +40,8 @@ void runMetronome() {
|
||||
|
||||
digitalWrite(BUTTON_LED_PIN, countdown % 2 ? HIGH : LOW);
|
||||
} else if (countdown == 0) {
|
||||
//tone(BUZZER_PIN, 1000, 100);
|
||||
//tone(BUZZER_PIN, 300, 100);
|
||||
}
|
||||
}
|
||||
|
||||
void updateTube() {
|
||||
char tube_str[5];
|
||||
|
||||
if (countdown <= 0)
|
||||
sprintf(tube_str, "%4u", (unsigned int) (temperature * 100.0));
|
||||
else
|
||||
sprintf(tube_str, "%4u", countdown);
|
||||
|
||||
tube.displayString(tube_str);
|
||||
}
|
||||
|
||||
void loop() {}
|
||||
|
||||
Reference in New Issue
Block a user