date calculating logic

I want to make a buzzer go ON every hour based on the current RTC time minus the date saved in the EEPROM (let's say it's 11:10 on rtc and 10:20 saved on eeeprom) but the minutes keep

if (rtc.hour - EEPROM.read(27) >= 1 && rtc.minute - EEPROM.read(28) >= 00)

I've been seeing so much code these days I'm not even thinking properly, could someone help me out?

In what way do you consider 10:20 a date?

I want to make a buzzer go ON every hour based on the current RTC time minus the date saved in the EEPROM

I really don't understand this. If the buzzer is to go on EVERY hour, what role does the value in EEPROM play?

et's say it's 11:10 on rtc and 10:20 saved on eeeprom

OK. Given that is is 11:10, and 10:20 is in the EEPROM, what, exactly, do you want to have happen?

Very confusing. Do you perhaps mean that you have a time (not a date) saved in EEPROM and you want the buzzer to sound when the RTC shows a time which is at least one hour later than that time?

So for some reason your only example shows two times when the buzzer shouldn't sound because there's only 50 minutes between them? Or do you mean something completely different?

If it is that first thing then your if() definitely isn't right. 11:00 is over an hour more than 9:59 but 00 - 59 definitely isn't >= 0.

Steve

I just want to know if my logic is correct, because I'm having a hard time about the minutes

it just check if it has passed 1hour since the last buzz by calculating the current time with the saved one

PaulS:
In what way do you consider 10:20 a date?
I really don't understand this. If the buzzer is to go on EVERY hour, what role does the value in EEPROM play?
OK. Given that is is 11:10, and 10:20 is in the EEPROM, what, exactly, do you want to have happen?

when the buzzer goes on, it saves the time on the eeprom, so It can later check if it has passed 1hr

sxarthur:
I just want to know if my logic is correct, because I'm having a hard time about the minutes

As I already said, your logic isn't correct. You need to do the whole comparison in minutes. Maybe something like

if ((rtc.hour - EEPROM.read(27)) * 60 + (rtc.minute - EEPROM.read(28)) >= 60)

Steve

I actually checked if the result was correct in Wolfram, but looks like the "if" is having issues with multiple brackets/parenthesis, since the eeprom.read have some too(for position).
been trying multiple ways but doesn't seem to work, maybe I'll have to set a variable as the eeprom.read value?

maybe I'll have to set a variable as the eeprom.read value?

That would be logical. That way, you can print the value, to be certain that the value is being saved/retrieved correctly.

Now it's working, I've been having problems because arduino was pointing an error to the eep and eppr
but it was actually the hour and minute, that was without ()
as below:

bool LastBipTimerChecker(DateTime test)
{
int eep = EEPROM.read(27);
int eepr = EEPROM.read(28);

  if ((test.hour - eep) * 60 + (test.minute - eepr) >= 60)

now it's working:

if ((test.hour() - EEPROM.read(27)) * 60 + (test.minute() - EEPROM.read(28)) >=60

Thanks!

I'm sorry but I don't believe it's what you want. This test is true whenever the current time (test.hour) is greater than by not equal to the hour value stored in EEPROM, whatever the value of the minutes.

So if you stored say 10:20 in the EEPROM, the test will be true constantly from 11:20 up to 23:59

lesept:
I'm sorry but I don't believe it's what you want. This test is true whenever the current time (test.hour) is greater than by not equal to the hour value stored in EEPROM, whatever the value of the minutes.

So if you stored say 10:20 in the EEPROM, the test will be true constantly from 11:20 up to 23:59

Not if, as stated, the values in the EEPROM are changed whenever the buzzer sounds. So at 11:20 (or 21 or whenever) the values in the EEPROM change to 11:20 and at 11:21 the test is no longer true.

Steve