Hello Comunity,
I have a mkrfox1200 in deepsleep(waking up maybe every hour) and by pressing a button the module has to wake up and show some bla bla, maybe 5 or 10 seconds, and then get to sleep for the remaining part of the 1hour cycle.
Thats my idea....
Asking Google about interrupts i found a lot Articles , but im not shore if this way is the right one for me!
the code in the interrupt function has to be as short as possible, but i need various seconds and different methods, so the code is not very short.
i have here my testcode but it doesent work
#include <SigFox.h>
#include <ArduinoLowPower.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#include <OneWire.h>
#include <DallasTemperature.h>
Adafruit_PCD8544 display = Adafruit_PCD8544(5, 4, 3);
#define ONE_WIRE_BUS 7
OneWire ourWire(ONE_WIRE_BUS);
DallasTemperature sensors(&ourWire);
long counter;
void setup() {
sensors.begin();
display.begin();
display.clearDisplay();
display.setContrast(50);
display.display();
display.clearDisplay(); // clears the screen and buffer
pinMode(0, INPUT_PULLUP);
LowPower.attachInterruptWakeup(0, showDisplay , FALLING);
}
void loop() {
counter++;
LowPower.deepSleep(10000);
}
void showDisplay() {
unsigned long starttime = millis();
while (millis() - starttime <= 2000) {
sensors.requestTemperatures();
float tmp = sensors.getTempCByIndex(0);
display.setTextSize(2.5);
display.setTextColor(BLACK);
display.setCursor(0, 0);
display.print(tmp);
display.display();
display.clearDisplay();
}
}
can somebody help me???