I AM USING ARUDUINO LEONARDO WITH DS1307RTC module the time is syncing with Arduino after about 15 minutes, any body who have encounterd same problem please suggest possible causes ??
Thanks in advance
Are you using time.h? if so did you set a syncprovider?
Now i am using the following code (part)
The sync happens after 6 to 15 minutes of power up
I tried with syncProvider too result is same
Pin 4 is connected to DS1307RTC - DS point
thanks for your support
#include <Time.h>;
#include <Wire.h>;
#include <DS1307RTC.h>; // a basic DS1307 library that returns time as a time_t
const int buttonPin = 3; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
const int relayPin1 = 8; // the number of the Relay1 pin
const int relayPin2 = 9; // the number of the relay 2 pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
time_t t;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(relayPin1, OUTPUT);
pinMode(relayPin2, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT_PULLUP);
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
Serial.begin(9600);
//setSyncProvider(DS1307RTC::get); // the function to get the time from the RTC
//setTime(13,22,0,31,8,2012);
//setTime();
}
// the loop routine runs over and over again forever:
void loop() {
//setSyncProvider(DS1307RTC::get); // the function to get the time from the RTC
digitalWrite(4, HIGH);
t = (DS1307RTC::get());
if(year(t)!=2012){
digitalWrite(relayPin2, HIGH);
Serial.println(" NOT IN SYNC ");
delay(1000);
digitalWrite(relayPin2, LOW);
}