• 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

Check for certain time of day

Q&A Forum › Check for certain time of day
0 Vote Up Vote Down
Graham Gibb asked 4 years ago

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.

1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

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

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] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

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

Copyright © 2013-2023 · 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.