PaulS:
int gtemp = gtemp = EEPROM.read(f);
This was a Find/Replace error. I never noticed it but it is fixed now.
it should be:
int gtemp = EEPROM.read(f)
PaulS:
You are pissing away memory all over the place. The EEPROM.read() function does not return an int. Storing the byte that it returns in an int wastes memory.
You don't have more than 256 pins on your Arduino, so all variables holding pin numbers should be byte, not int.
A pin can not be in more than 256 states, so all variables hold pin states should be byte, not int.
I've thought of this but never actually seen it done so I thought there was a specific reason more people don't do this. I've updated my code to reflect your reply. BUT! I know you mentioned the one also should be byte. This one must be an int due to the final value after it reads the memory.
PaulS:
Use the F() macro to stop copying literals into SRAM unnecessarily.
Serial.println(F("********** System Variables ***********"));
Never heard of this but included it.
PaulS:
Your code seriously needs commenting. The only comments in it are useless.
WHY does the code do what it does? THAT is what you need to document with comments. The fact that a } represents the end of an if statement or a function is obvious.
Agreed but its not done. I'll try to add more comments for future reference.
Robin2:
Do you literally mean that line 135 works and line 136 does not?
If that is not what you mean please explain in detail.
If this was my problem I would try disabling parts of the program to figure out what is causing the problem. My wild guess is that something is corrupting your memory - for example writing past the end of an array.
You have a very extensive program - when, during its development, did this problem surface? Can you go back to the version that worked immediately before the problem arose and see what subsequent changes were made that might have caused the problem?
...R
Actually yes. According the Serial monitor when it happened yesterday it did run line 135 saying the sketch was "starting". But did not send anything after.
It is a very "random" issue that is not consistent enough to debug by disabling parts of it to my knowledge. Thus the reasoning by my post. I was looking for anything that I might have missed which I did not notice a couple of things that were pointed out by everyone.
Whandall:
@Whandalls post
I have fixed the StateArray indx issue.
EEPROM.write(address, x);
if (x == EEPROM.length()) .. do something
This is how it is "shown" in the EEPROM reference. So its odd that its throwing an error. Am I missing something?