hi,
i made a program so i can have a schedule restart on my router... I set that when its 6.30am relay is off for 60 sec and on all other time. my relay doesnt work all that other time, i tried to swap pin, same thing!
Here is programe i wrote:
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
int relay = 9;
void setup () {
Serial.begin(9600);
Wire.begin();
RTC.begin();
if (! RTC.isrunning()) {
Serial.println("RTC is NOT running!");//Postavlja vrijeme na TINY RTC
RTC.adjust(DateTime(DATE, TIME));
}
}
void loop () {
DateTime now = RTC.now();
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println(); //Prikazuje vrijeme u serial monitoru
delay(1000);
if(now.hour() ==6){
if(now.minute() == 30){
digitalWrite(relay,HIGH);//Relej off
}
else{
digitalWrite(relay,LOW);//Relej on
}
}
}
i am from croatia sorry if u dont understand notes