Need help with code for greenhouse automation

Okay, you obviously don’t understand how a C++ sketch executes.
The Boid Setup runs once, then when it’s competed the void loop runs constantly, hundreds, if not thousands of times per second.
The timer.run in your void loop will execute multiple times until it’s time to call the sendSensor function.

Your code tells the ESP to go to sleep before the void setup completes. Void loop never executes, neither does your sendSensor function because it’s never called.

Timers have no place in a deep sleep sketch, because they just waste time, forcing your code to wait unnecessarily, which just lengthens the awake time.

I’d suggest that you read through this topic if you want to learn more about how to structure deep sleep code:

Pete.

2 Likes