RTC Timer events

I am trying to create a timer using my RTC device. I was using the Time Alarms library but then got some good advice to not have the RTC be dependant off the time alarms library. The code below I posted works fine. The relay goes on and off when it should but at specific times. How do I code it to read every X minutes? I tried simply putting a comma after the first hour and minute value but that didn’t work.

For example… I tried putting an OR operator but that didn’t work. This is probably going to get real long if I want the timer to be utilized all 24 hours in the day. There’s got to be an easier way f doing this. Any advice? Thanks

if ((tm.Hour ==03,03,03)&&( tm.Minute== 29 ,39,49 ) && (tm.Second==30))digitalWrite(R1, RF);
#include "Wire.h"
#include "DS1307RTC.h"
#include "Time.h"

#define RN 1 //on
#define RF 0 //off
#define R1  9  

void setup() {
  
  digitalWrite(R1, RN);
  pinMode(R1, OUTPUT);   

  Serial.begin(9600); 

  setSyncProvider(RTC.get);


} //End of Void Setup

void loop() {     
  Alarm1();        
} //End of Loop   


void Alarm1()
{
  tmElements_t tm; 
  if (RTC.read(tm)) {

    if ((tm.Hour ==03 )&&( tm.Minute== 29  ) && (tm.Second==30))digitalWrite(R1, RF);
    if ((tm.Hour ==03 )&&( tm.Minute==30 ) && (tm.Second==30))digitalWrite(R1, RN);
  }
}

You need modular arithmetic.

if (.... && minute % X == 0 && ....)

MarkT, please explain this

if (.... && minute % X == 0 && ....)

So a remainder is obtained after an integer is divided by another. I want it to be every 10 minutes. How do I do that? I got confused by the periods in your response. Is this what you mean?

if(tm.Minute % 10 ==0)

Do I need to call the hour as well? So then it would be something like this?

if(tm.Hour % 1==0 && tm.Minute % 10 ==0)

I am confused on the hour part? Would I need to specify that when I only want it every 10 minutes?

You can use the timeAlarms library if programming isn't your forte. It'll trigger events for you without you writing if statements.

It'll trigger events for you without you writing if statements.

My goal is to write the If statements and not use the library. Ive been having issues with multiple events and interference. So how would you write every 10 minutes using modular arithmetic ...anyone?

if ((minutes % 10) == 0) // will fire at 10, 20, 30...

And it is modulo not modular arithmetic.