I have a question about DeepSleep and Interrupts.
Assume this simple scenario:
- Arduino Nano + ESP-01
- PIR Sensor on Interrupt
- LastPIR_State Variable
- MQTT Client
My problem, I want to e.g. send an MQTT message on PIR detection, then go back to sleep. Without the sleep I could simply write a loop which checks for state change of PIR, if detected, send MQTT and so on..
Now simply moving the "checkStateAndSend" to interrupt function is not feasable (mqtt and possible WLAN setup takes to long). Now I am asking myself what effect does interrupt have on logic, like if I have:
SETUP:
- Register the interrupt handler
LOOP:
- CheckStateAndSendMQQT
- GoToDeepSleep
INTERRUPT:
- Basically do nothing, just wake up
Would the interrupt trigger one execution of CheckStateAndSendMQQT or would it just wake up, do nothing, go back to sleep? If so, any elegant way of "starting" a longer lasting routine from Interrupt while sleeping?
Thanks, (I tried searching, btw, but its a bit of to generic search terms)
Chris