Pages: [1]   Go Down
Author Topic: Date and time with DS1307  (Read 465 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi there

I have a DS1307 connected up to my Arduino which is working great.  I can read the time from it and write to it.

From the DS1307 I get the date and time.  Does anyone know how to get which day it is?  ie the DS1307 knows that today is the 13th but can it also tell me that today is a Thursday?

David
Logged

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 71
Posts: 2612
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What library are you using to access the DS1307? I use RealTimeClockDS1307 https://github.com/davidhbrown/RealTimeClockDS1307 and it has a getDayOfWeek() to access the DAY register (3) on the DS1307. Most other libraries will probably have a similar function. Note that you need to set the DAY register correctly when setting the date & time. It is not a calculated value from the date but just a counter that counts from 1 to 7 and then resets back to one. This allows you to use what ever value you want (between 1 and 7) as the first day of the week.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi there

I am using the library from Ladyada - http://www.ladyada.net/learn/breakoutplus/ds1307rtc.html

But it does not seem to have that function.

David
Logged

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 71
Posts: 2612
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am using the library from Ladyada - http://www.ladyada.net/learn/breakoutplus/ds1307rtc.html
But it does not seem to have that function.
For that library I think you use dayOfWeek()
Logged


Pages: [1]   Go Up
Jump to: