First of all, I'm not using Adafruit's RTC shield, but I got a very similar one (battery powered). However it seems that something is not working with RTClib (which I got from Adafruit tutorial link), specifically setting time. I mean it doesn't set time at all.
RTC.adjust(DateTime(__DATE__, __TIME__)); is completely ignored, and year always shown as 2001 (or maybe even 2000).
It's not my module or wiring either, I was able to set time using example from another site that doesn't use RTCLib. Also RTCLib works fine for getting time/date off the DS1307.
Could it be because I'm on OSX (Mnt. Lion) or using compiler 1.0.1? Is it supported by this library?
Is there issue with RTC Library?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88090
- Joined: Sat Feb 07, 2009 10:11 am
Re: Is there issue with RTC Library?
RTCLib works with all the RTC modules and RTC-equipped shields that we sell in the Adafruit store. There are no compatibility issues with Mac OSX or any of the Arduino releases.
Your module may be designed differently.
Your module may be designed differently.
-
- Posts: 4
- Joined: Sat Sep 29, 2012 9:15 pm
Re: Is there issue with RTC Library?
Thanks! It's strange that problem is only during setting of the time..
- fmbfla
- Posts: 110
- Joined: Fri Jun 08, 2012 6:48 pm
Re: Is there issue with RTC Library?
are you "uncommenting the line " " RTC.adjust(DateTime(__DATE__, __TIME__)); "
for the initial upload, and then commenting out "//RTC.adjust(DateTime(__DATE__, __TIME__));"
On the second upload?
for the initial upload, and then commenting out "//RTC.adjust(DateTime(__DATE__, __TIME__));"
On the second upload?
Code: Select all
void setup () {
Serial.begin(57600);
Wire.begin();
RTC.begin();
if (! RTC.isrunning()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
//RTC.adjust(DateTime(__DATE__, __TIME__)); uncomment to set, comment out to use.
}
}
Please be positive and constructive with your questions and comments.