I have a little problem with esp_now with the transmitter program. (see https://randomnerdtutorials.com/esp32-esp-now-wi-fi-web-server/). If we take the program but modified for an esp8286, everything works perfectly. The receiver is an esp32 and the program is the same as the site. But if I put these instructions right after Serial.print (“loop”).
The problem is, it always shows Readings ID = 0. It does not count then that if I remove these lines everything is correct.
Thank you for your help
I’ll mark this as resolved.
If you need further help, just open a new question.
Every time the ESP wakes up from deep sleep, it will run the code from the start.
If you have the variable declaration like this
unsigned int readingId = 0;
It will start at zero every time it wakes up.
Besides, the variables are erased during deep sleep. So, if you want to retain variables values during deep sleep, you need to save them on non-volatile memory and get the variable value after each sleep.
You can use the EEPROM library or write a file in spiffs to save your variable.
- https://randomnerdtutorials.com/install-esp8266-filesystem-uploader-arduino-ide/ (see “Testing the Uploader”).
I hope this helps.
Let me know if you need further help.