• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Problem with esp_now

Q&A Forum › Category: Questions › Problem with esp_now
0 Vote Up Vote Down
Michel Tremblay asked 5 years ago

Hello
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”).
esp_now_deinit ();
ESP.deepSleep (60e6); 

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
Michel

3 Answers
0 Vote Up Vote Down
Best Answer
Sara Santos Staff answered 5 years ago

Great!
I’ll mark this as resolved.
If you need further help, just open a new question.
Regards,
Sara

0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi Michel.

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://github.com/esp8266/Arduino/tree/master/libraries/EEPROM/examples
  • 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.

Regards,
Sara

0 Vote Up Vote Down
Michel Tremblay answered 5 years ago

Hi Sara
It’s true, I should have thought about it. I knew about it. you can close this question. thank you for your precious help
Michel

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.