DS1307 Real Time Clock
Moderators: adafruit_support_bill, adafruit

DS1307 Real Time Clock

by burchd on Tue Feb 21, 2012 5:51 pm

I have a DS1307 and i was looking for Arduino programming examples for it. I found what there is on the NetDuino, but wondered if there was aything for Arduino?

Thankyou

db
burchd
 
Posts: 1
Joined: Tue Jan 10, 2012 1:07 am

Re: DS1307 Real Time Clock

by adafruit_support_bill on Wed Feb 22, 2012 7:21 am

There is a link to the library on the tutorial page: http://github.com/adafruit/RTClib
User avatar
adafruit_support_bill
 
Posts: 30887
Joined: Sat Feb 07, 2009 10:11 am

Re: DS1307 Real Time Clock

by bigwestwc on Sat Jun 16, 2012 1:58 pm

adafruit_support wrote:There is a link to the library on the tutorial page: http://github.com/adafruit/RTClib
I been running the clock now with the sketch, but i have a small problem it reads the time like this 12:6:7 instead of 12:06:07...
do you know any way to put the 0's when just reading single digits?
bigwestwc
 
Posts: 9
Joined: Tue Oct 25, 2011 12:57 pm

Re: DS1307 Real Time Clock

by adafruit_support_bill on Sat Jun 16, 2012 2:53 pm

One way is like this:
Code: Select all | TOGGLE FULL SIZE
    if(now.hour() < 10)
        Serial.print("0");
    Serial.print(':');    Serial.print(now.hour(), DEC);
    Serial.print(':');
    etc,


Or you can format the string using sprintf.
User avatar
adafruit_support_bill
 
Posts: 30887
Joined: Sat Feb 07, 2009 10:11 am