I'm making a alarm, using ds1307. I want to program the alarm using a lcd shield display, and the problem is that i can print the display but the arduino freezes when I call the function to read the data alarm from the EEPROM.
I'm using like this: addr 0 = hour; addr 1 = minute; addr 2 - 8 days of the week, addr 9 - duration alarm in seconds. So i'm using 10 memorys for each alarm program, my atmega have 1024 bytes, so I can have 102 alarms programs.
I don't understand the reason why arduino freezes. Thanks.
void ler_eeprom() {
//------Read Program Values
{
if (flag_Refresh == 1) { //flag to read just one time
addr = programa * 10; //multiply by 10 to jump to save 10 memories for each program
if (EEPROM.read(addr) > 24)
hour= 0;
else
hour= EEPROM.read(addr); //hour
if ( EEPROM.read(addr + 1) > 59)
minute= 0;
else
minuto = EEPROM.read(addr + 1); //minute
for (int i = 2; addr < 9; i++) {
if (EEPROM.read(addr + i) > 1)
dayOfTheWeek = 1;
- else*
_ dayOfTheWeek = EEPROM.read(addr + i);_
* }*
* if (EEPROM.read(addr + 9) > 10)*
* duration_alarm= 3;
_ else*_
* duration_alarm= EEPROM.read(addr + 9); //alarm duration*
* flag_Refresh= 0;
_ }_
_ }_
_}_
1_leitura_e2prom.ino (811 Bytes)*