I have an Arduino Pro Mini ATmega328P 3.3V 8M with a DS3231 RTC. My project consists of a transistor triggering a button at 10 second intervals at certain times of the day. I have originally been using the delay function as I have no coding experience and just wanted to come up with something simple while I try to figure out how to use the RTC.
void setup()
{
pinMode(2, OUTPUT);
}
void loop() {
for (int i=0; i<4320; i++)
{
digitalWrite(2, HIGH); // 7pm - 7am Loop Enabled
delay(1000);
digitalWrite(2, LOW);
delay(9000);
}
delay(3600000); // 7am - 8am Loop Disabled
for (int i=4320; i<5040; i++)
{
digitalWrite(2, HIGH); // 8am - 10am Loop Enabled
delay(1000);
digitalWrite(2, LOW);
delay(9000);
}
delay(7200000); // 10am - 12pm Loop Disabled
for (int i=5040; i<6480; i++)
{
digitalWrite(2, HIGH); // 12pm - 4pm Loop Enabled
delay(1000);
digitalWrite(2, LOW);
delay(9000);
}
delay(10800000); // 4pm - 7pm Loop Disabled
for (int i=6480; i<8280; i++)
}
Like I mentioned earlier, I have no coding experience and I can't figure out which library to use for the RTC and what functions to use to set the pin output to high.
To be clear, the schedule I want is:
7pm-6:59am (Loop Enabled)
7am-7:59am (Loop Disabled)
8am-9:59am (Loop Enabled)
10am-11:59pm (Loop Disabled)
12pm-3:59pm (Loop Enabled)
4pm-6:59pm (Loop Disabled)
Please ask any questions for clarification. Any help is greatly appreciated!