Add BME280 temperature display on timer ISR
This commit is contained in:
16
metronom.ino
16
metronom.ino
@@ -1,3 +1,15 @@
|
||||
#include "SAMDTimerInterrupt.h"
|
||||
#include "SAMD_ISR_Timer.h"
|
||||
|
||||
#define HW_TIMER_INTERVAL_MS 10
|
||||
SAMDTimer ITimer(TIMER_TC3);
|
||||
SAMD_ISR_Timer ISR_Timer;
|
||||
|
||||
void TimerHandler(void) {
|
||||
ISR_Timer.run();
|
||||
}
|
||||
|
||||
|
||||
const uint BUZZER_PIN = 0;
|
||||
|
||||
const uint BUTTON_LED_PIN = 5;
|
||||
@@ -14,6 +26,10 @@ void setup() {
|
||||
// Order of ISRs matter: RISING should be invoked first
|
||||
attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), buttonISRtime, CHANGE);
|
||||
attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), buttonISRstate, RISING);
|
||||
|
||||
initTemperature();
|
||||
ITimer.attachInterruptInterval_MS(10, TimerHandler);
|
||||
ISR_Timer.setInterval(1000, readTemperature);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
Reference in New Issue
Block a user