I have made a bee hive monitoring system that sleeps 1 h between each data collection
I need to tare or calibrate my weight sometimes and for that I have 2 buttons.
These 2 buttons are also sleeping, and don't work for me while in sleep.
const int switchTare = 34;
const int switchCalibrate = 35;
How I do it today is first press reset, then system waits for 10 sec to sense if a button is pressed.
Q: How I like it to work is that I can press tare or calibrate without this reset/wait
Here is my if{} code today that starts after a reset:
if (reason == ESP_RST_POWERON) {
if (digitalRead(switchCalibrate) == LOW) { // check if switchCalibrate is pressed
functionCalibrate();
}
if (digitalRead(switchTare == LOW) { // check if switchCalibrate is pressed
functionTare();
}
Here is my sleep command
esp_deep_sleep_start(); /wait for 1 h until new start
Can you give me some feedback how to make my calibrate and tare kick in, maybe some interupt?
Wake up the controller every few seconds and have it read your button pins. This way, you'll have to hold the button for a bit until the controller happens to be awake and can do something.
Otherwise select a power mode that keeps the GPIO's active all the time, but these will not be as economic as deep sleep since the GPIO clock and several other clocks will have to keep running.
Check that link I gave above. It doesn't use the buttons you already have, but it should be easy enough to break out two of the touch-enabled GPIOs to the outside world.