hello everyone,
Am a follower of Jeremy Blum tutorials and his book exploring arduino is the one assist me to know element14 arduino community.
my problem is how i can use DS1307 to track time for counting days and display it on seven segment display. i want counter to counting up days from 00 day to 99 days i.e counting up ( incrementing by one number) at the interval of 24hrs. However i manage to count with the use of millis() but problem comes as i introduce RTC.....i want to use RTC for assisting counting number of days because millis() is messing on me once the arduino power is off.
i have
1. Arduino Uno
2. RTC-ds1307
3. crystal 32.768kHz
4. 2 pull up resistor each 2.2k
5. 2 Seven Segment Displays(Common Cathode)
6. 2 shift register, 74HC595
7. 16 resistor of 680Ohm for connection between shift registers and seven segment displays
i attachment of my diagram and arduino sketch for counting, anyone with the help in both diagram and arduino sketch i will appriciate.
[code]
#define LATCH 12
#define CLK 13
#define DATA 11
int i,j;
int digitOne[10] = {63,6,91,79,102,109,125,7,127,103};
int digitTwo[10]= {63,6,91,79,102,109,125,7,127,103};
//other stuff
unsigned long startTime;
void setup()
{
startTime = now.unixtime();
pinMode(LATCH, OUTPUT);
pinMode(CLK, OUTPUT);
pinMode(DATA, OUTPUT);
}
void loop()
{
int dayCount = (now.unixtime() - startTime)/ 86400;
displayDaycount(dayCount);
}
displayDaycount(int numberOfDays)
{
for(int i=0; i<10; i++){
for(int j=0; j<10; j++){
digitalWrite(LATCH, LOW);
shiftOut(DATA, CLK, MSBFIRST, ~digitTwo[j]); // digitTwo
shiftOut(DATA, CLK, MSBFIRST, ~digitOne[i]); // digitOne
digitalWrite(LATCH, HIGH);
}
}
}
[/code]
here is my diagram: