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);
}
}