Thank you both for your help!
I was wondering if I could use the clock as a backup I will check out the code in a while XD
Now I have another question, I am more of a hardware than a software man so my menu code is probably a little overcomplicated more so than it should be, my whole program is controlled by IR commands so it is not as easy as setting a button to go in to a menu I will post the code below but was wondering if there is an easier way to do the menu, or an easier way to write to the EEPROM or DS1307 memory?
The code below is for the on/off time settings it basically flashes the time stored in weekOn, weekOff, weekendOn and weekendOff and if a button is pressed that increases the value, most of the code is used to set the buttons from the IR command and the LCD print out so where would I add the EEPROM command would there be an exit command in here to write it, the LED string is set in exactly the same way?
////////////
// Menu 1 //
////////////
if(menu == 1){
if(forward == 1){
if(next == 0){
next = 1;
} else {
if(next == 1){
next = 2;
} else {
if(next == 2){
next = 0;
}
}
}
}
if(back == 1){
if(next == 2){
next = 1;
} else {
if(next == 1){
next = 0;
} else {
if(next == 0){
next = 2;
}
}
}
}
if(next == 0){
lcd.home();
lcd.print("Set time on");
Serial.println("Set time on");
lcd.setCursor(0,1);
lcd.print("Weekdays ");
lcd.print(weekOn);
lcd.print(":00");
lcd.setCursor(0,2);
lcd.print("Weekends ");
lcd.print(weekendOn);
lcd.print(":00");
lcd.setCursor(0,3);
lcd.print("J3=B J7=F F3=D F4=U");
}
if(next == 1){ // Set Weekdays on time
// Up/Down to change value
if(up == 1){
if(weekOn == 23){
weekOn = 0;
} else {
weekOn ++;}
}
if(down == 1){
if(weekOn == 0){
weekOn = 23;
} else {
weekOn--;}
} // End of value commands
lcd.home();
lcd.print("Set time on");
lcd.setCursor(0,1);
lcd.print("Weekdays ");
lcd.setCursor(0,2);
lcd.print("Weekends ");
lcd.print(weekendOn);
lcd.print(":00");
lcd.setCursor(0,3);
lcd.print("J3=B J7=F F3=D F4=U");
if(counter < flashCount){
counter++;
lcd.setCursor(9,1);
lcd.print(weekOn);
lcd.print(":00");
flashCounter = flashCount;
} else {
if(flashCounter <= flashCount){
flashCounter--;
lcd.setCursor(9,1);
lcd.print(" ");
} if(flashCounter == 0){
counter = 0;
}
}
} else {
lcd.setCursor(9,1);
lcd.print(weekOn);
lcd.print(":00");
} // End of setting Weekdays on time
if(next == 2){ // Set Tuesday on time
// Up/Down to change value
if(up == 1){
if(weekendOn == 23){
weekendOn = 0;
} else {
weekendOn ++;}
}
if(down == 1){
if(weekendOn == 0){
weekendOn = 23;
} else {
weekendOn--;}
} // End of value commands
lcd.home();
lcd.print("Set time on");
lcd.setCursor(0,1);
lcd.print("Weekdays ");
lcd.print(weekOn);
lcd.print(":00");
lcd.setCursor(0,2);
lcd.print("Weekends ");
lcd.setCursor(0,3);
lcd.print("J3=B J7=F F3=D F4=U");
if(counter < flashCount){
counter++;
lcd.setCursor(9,2);
lcd.print(weekendOn);
lcd.print(":00");
flashCounter = flashCount;
} else {
if(flashCounter <= flashCount){
flashCounter--;
lcd.setCursor(9,2);
lcd.print(" ");
} if(flashCounter == 0){
counter = 0;
}
}
} else {
lcd.setCursor(9,2);
lcd.print(weekendOn);
lcd.print(":00");
} // End of setting on time
} // End of menu 1
////////////
// Menu 2 //
////////////
if(menu == 2){
if(forward == 1){
if(next == 0){
next = 1;
} else {
if(next == 1){
next = 2;
} else {
if(next == 2){
next = 0;
}
}
}
}
if(back == 1){
if(next == 2){
next = 1;
} else {
if(next == 1){
next = 0;
} else {
if(next == 0){
next = 2;
}
}
}
}
if(next == 0){
lcd.home();
lcd.print("Set time off");
Serial.println("Set time off");
lcd.setCursor(0,1);
lcd.print("Weekdays ");
lcd.print(weekOff);
lcd.print(":00");
lcd.setCursor(0,2);
lcd.print("Weekends ");
lcd.print(weekendOff);
lcd.print(":00");
lcd.setCursor(0,3);
lcd.print("J3=B J7=F F3=D F4=U");
}
if(next == 1){ // Set Weekdays on time
// Up/Down to change value
if(up == 1){
if(weekOff == 23){
weekOff = 0;
} else {
weekOff ++;}
}
if(down == 1){
if(weekOff == 0){
weekOff = 23;
} else {
weekOff--;}
} // End of value commands
lcd.home();
lcd.print("Set time off");
lcd.setCursor(0,1);
lcd.print("Weekdays ");
lcd.setCursor(0,2);
lcd.print("Weekends ");
lcd.print(weekendOff);
lcd.print(":00");
lcd.setCursor(0,3);
lcd.print("J3=B J7=F F3=D F4=U");
if(counter < flashCount){
counter++;
lcd.setCursor(9,1);
lcd.print(weekOff);
lcd.print(":00");
flashCounter = flashCount;
} else {
if(flashCounter <= flashCount){
flashCounter--;
lcd.setCursor(9,1);
lcd.print(" ");
} if(flashCounter == 0){
counter = 0;
}
}
} else {
lcd.setCursor(9,1);
lcd.print(weekOff);
lcd.print(":00");
} // End of setting Weekdays on time
if(next == 2){ // Set Tuesday on time
// Up/Down to change value
if(up == 1){
if(weekendOff == 23){
weekendOff = 0;
} else {
weekendOff ++;}
}
if(down == 1){
if(weekendOff == 0){
weekendOff = 23;
} else {
weekendOff--;}
} // End of value commands
lcd.home();
lcd.print("Set time off");
lcd.setCursor(0,1);
lcd.print("Weekdays ");
lcd.print(weekOff);
lcd.print(":00");
lcd.setCursor(0,2);
lcd.print("Weekends ");
lcd.setCursor(0,3);
lcd.print("J3=B J7=F F3=D F4=U");
if(counter < flashCount){
counter++;
lcd.setCursor(9,2);
lcd.print(weekendOff);
lcd.print(":00");
flashCounter = flashCount;
} else {
if(flashCounter <= flashCount){
flashCounter--;
lcd.setCursor(9,2);
lcd.print(" ");
} if(flashCounter == 0){
counter = 0;
}
}
} else {
lcd.setCursor(9,2);
lcd.print(weekendOff);
lcd.print(":00");
} // End of setting off time
}
Thank you for pointing me in the right direction!