So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By summersab
#75660 I'm fairly noob-ish with the ESP and Arduino as a whole, thought I do have a solid IT background - my skills are just more in the higher-level abstraction levels like system administration and architecture. So, that's my introduction :)

I'm trying to get the ESP to basically work like a Christmas light timer:
  1. Set a time via a web console
  2. ESP gets a NTP update
  3. ESP goes into light sleep for 1/2 the time remaining
  4. Go to 2. until the remaining time is 10 minutes
  5. Go to sleep and set GPIO1 to high on wake-up

I'm reasonably confident that I can do the things like creating a web console and performing a NTP update based on the examples provided in the Arduino IDE, but what I can't seem to figure out is how to do light sleep. Everyone seems to be WAY more interested in deep sleep, and for a lot of embedded/battery-powered projects, I totally understand that.

However, since my code isn't completely static (I want to be able to pick a wake-up time that isn't hard-coded), I can't use deep sleep since it will wipe any variables I've set. If someone could help me figure out how to do a light sleep loop that enables and disables WiFi on each iteration, that would be awesome. Also, having the ability to wake the ESP from sleep via GPIO would be great, too (use case: if I want to wake up the system to change the time I just set).

Thank you!