Timed events at specific time?

I am wondering if anyone can give me suggestions on what library to use. I know millis timers are the go to route (and i am implementing them for other functions), however I don't think millis can run a function at a specific time of the day, regardless if the device has rebooted (hence resetting the timers so no good). I have an event that needs to run at 9:30PM, 10PM and 7AM. Any ideas? Thank you for your time.

Look at the DS3231 RTC.

The machine im working with has an BM8563 rtc integrated. Or were you saying look at the library for it?

If you have an RTC, then use it.

This is an Arduino forum. Unless BM8563 can talk to Arduino, this is meaningless. If it can't, read reply #2 again.
There are alarm libraries for Arduino that may be suitable, or you can simply code something like:

if hours = 22
do stuff
and set flag so you don't do it every time round

if hours = 23
unset flag

I'm fully aware this is a arduino forum. This device runs ESP32, hence I'm here.
Sorry not trying to cause conflict I'm still learning this, I was asking because I wasn't sure about the rtc being an approach.

I remember on another post someone suggested something like the following

 if ((localTimeInfo.tm_hour = 10 && (localTimeInfo.tm_min = 28)) && (testrun = false));

For the life of me, I can't get it to work, I had it work for a minute but it was a stuck loop, the true flag never got passed for some reason and it overflowed the audio buffer trying to start a wav file every ms. and now i cant get it back again. Did i format this right? Any ideas whats wrong? this is placed in loop btw.

 if ((localTimeInfo.tm_hour = 10 && (localTimeInfo.tm_min = 28)) && (testrun = false));{
 Serial.println("testrun is false");
 testrun();
 testrun = true;

  }

= is not the same as ==         assignment vs equal to

Correct your mistakes . . .



See:

https://www.arduino.cc/reference/en/

And get rid of the ; at the end of if( ) ; <- - - -<<<<

Only reason the ; is there is because everything under it underlined as undefined if I remove it. So maybe there is something else I did to cause that....

= is not the same as == assignment vs equal to

I understood that when you posted before. Correcting that now.

Well couldn't get that string to work, and after going through the library's for my rtc I'm so lost. I'm not able to comprehend exactly what I could use

The code fragment below works just fine . . .


  DateTime now;

. . .

  now = rtc.now();
. . .

  //if the servo is free, is it 5AM ?
  //******************************
  if (servoFreeFlag == ENABLE && now.hour() == 5 && now.minute() == 0 && now.second() == 0)
{
   // do something 
}

Off the bat, pasting your code in presents only one error, identifier "DateTime" is undefined; rtc.now works (which never has for me in the past) Do you suppose the datetime unidentified will cause a problme if i comment out that line?
nevermind, rtc doesnt work commented out the datetime line now rtc is unidentified.

What RTC are you using ?


Did you include:

#include <Wire.h>
#include "RTClib.h" //https://github.com/adafruit/RTClib

This is the rtc im using, i have seen it referenced as a ds3231 and as a BM8563. I did include the rtclib from adafruit is that not the right one?

Let’s see what you have got. ?

In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.
Use the </> icon from the ‘reply menu’ to attach the copied sketch.


Show us a good schematic of your circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.

Yes

A couple things. I can't upload the whole sketch here, as it is about 4k lines im modifying an existing program to add new features at the authors request, which hopefully will make it to the main branch he says. So I can post it in like pastebin if you really want to go through that much code, or tell me sections and i can post those.

Wiring, I am using an m5core2 prebuilt box, its arduino based esp32.

Most experienced helpers have no problem finding the interesting parts in a large code. Parts of code, snippets, is the worst code to look at.