Hi,
Forgive me if this has been answered before,but I can’t find anything here or on the net. I’m probably not using the correct words.
I have managed to get the time from the NTP server and can print it, thanks to the ESP32 tutorials.
I now want to make something happen at certain times throughout the day. Unfortunately I don’t know how to access the hour, in order to compare it to the time I want something to happen.
i.e.
At 07:00 run a routine
At 14:00 run a routine
I guess what I am after is similar to an alarm clock, but I just can’t find any suitable code that shows how to get the values in a form that can be used in a comparison.
I s it even possible to access this value as a number?
Many thanks in advance.
Hi.
I haven’t found a library that does what you want. Meanwhile, if you find something, let us know.
This topic describes what you want to do, but I don’t know if it is easy/feasible to implement: https://www.esp32.com/viewtopic.php?t=4910
Maybe you need to constantly check the time, and when it is your desired hour, do something – however, I don’t know if it is good practice to do something like this.
In our example, the time and data are returned as Strings. The time is returned is this format: HH:MM:SS
Maybe you need to cut the string, and then convert the hour, minutes and seconds to int. (I haven’t tried this, this is just a suggestion on how it might work).
I hope this helps.
Regards,
Sara