Add BME280 temperature display on timer ISR

This commit is contained in:
cryptogopher
2022-09-09 13:07:56 +02:00
parent 4a46ee65b9
commit 3f5ce648d5
2 changed files with 37 additions and 0 deletions

View File

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