hi guys!
Im have a question about my RTC program.
It works but in need to sync my time from my PC to my RTC but i dont know how to do?
someone can help me or give me advise to improve my program!
Greetz
#include <Time.h>
#include <TimeLib.h>
#include <DS3232RTC.h> //GitHub - JChristensen/DS3232RTC: Arduino Library for Maxim Integrated DS3232 and DS3231 Real-Time Clocks
#include <Time.h> //http://www.arduino.cc/playground/Code/Time
#include <Wire.h> //Wire - Arduino Reference (included with Arduino IDE)void setup(void)
{
Serial.begin(9600);
setSyncProvider(RTC.get); // the function to get the time from the RTC
if(timeStatus() != timeSet)
Serial.println("Unable to sync with the RTC");
else
Serial.println("RTC has set the system time");
}void loop(void)
{
digitalClockDisplay();
delay(1000);
}void digitalClockDisplay(void)
{
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.print(' ');
Serial.print(day());
Serial.print(' ');
Serial.print(month());
Serial.print(' ');
Serial.print(year());
Serial.println();
}void printDigits(int digits)
{
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(':');
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}