What is the function of “esp_sleep_wakeup_cause_t” used in the funcion “print_wakeup_reason()”?
Hi Clyde.
The esp_sleep_wakeup_cause_t before the wakeup_reason variable is declaring the wakeup_reason variable as a type of esp_sleep_wakeup_cause_t.
For example, when you use:
int bootCount
You’re declaring the bootCount variable as an int type.
In this specific example, the wakeup_reason variable is declared to save the reason that caused the wakeup and print a message on the Arduino IDE Serial monitor for debugging and testing purposes. That way you know if the ESP has woken up because of the reason you’ve defined (or any other reason that has caused the wake up).
I hope this makes sense.
Regards,
Sara