Go Down

Topic: DS1307 time set error (Read 4464 times) previous topic - next topic


Jan 10, 2011, 10:27 pm Last Edit: Jan 10, 2011, 10:28 pm by Paulakiux Reason: 1

RTC worked until I have installed windows 7. Before I was using XP and RTC was setting by uploading program to arduino. I am using RTC library and setting line is:

if (! RTC.isrunning()) {
   RTC.adjust(DateTime(__DATE__, __TIME__));

Now, after uploading program to arduino, RTC shows not real time, like now is 23:25, it shows 6:40. What should I do?

Thanks for help, sorry for my English  :)


Code: [Select]
if (! RTC.isrunning()) {
  RTC.adjust(DateTime(__DATE__, __TIME__));

This code will adjust (not set) the time/date based on when the sketch was compiled. Is that what you really want to do?


Yes, it has been working until I have uploaded program with new OS. If this line is incorrect, what should I write?


I think, I will write win XP to my PC... :)


Found the problem :) Before I program arduino, I need to get off electricity of RTC and then time sets just 1 time. Smth mysterious  :-?


If the clock on your PC is wrong the code in the sketch won't work either.

Maximum accuracy can be obtained by using timeservers, however you need an ethernetshield. See - http://www.arduino.cc/playground/Main/DS1307OfTheLogshieldByMeansOfNTP
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


It also helps if you call RTC.set(), rather than RTC.adjust().

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131