I am using a timer to read the BMP280 sensor periodically - maybe every hour. Meanwhile nothing is to be done, so the processor might go to Deep Sleep. Should one abandon the timer an just use Deep Sleep?
Or what is the right way to implement Deep Sleep in combination with a Timer?
I am not sure about the strategy. Should the DeepSleep run within an endless loop or calling it with the Timer?
I tried with the Timer, but it does not wakeup. The wiring on the Nodemcu 1.0 board already looks right (assuming the resistors have the right values (12k). NODEMCU_DEVKIT_V1.0.PDF
B4X:
tmr.Initialize("tmr_Tick",1000)
tmr.Enabled = True
Private Sub tmr_Tick
Log("timer")
Log(k)
k=k+1
If k >= ssd.GFX.Width Then
k= 0
End If
If k = 127 Then
normalize
plott
End If
DeepSleep(100)
End Sub
The log (using the Timer) looks like this (had a little trouble to assemble this since the ESP log is at 74800 Baud whereas the B4R log comes at 115200 Baud).
I found more information on DeepSleep:
Among others, GPIO16 has to be connected to RST.
When I make that connection, DeepSleep works and the program runs periodically. The drawback is that the wakeup-Reset clears the SRAM.
So data are lost.
So, we have to make use of the EEPROM probably.
Or might there be a different solution?