Just posting a general programming/arduino problem.
My project is too vast to post code so will post a very simple psudo breakdown of the issue concerning the EEPROM
setup(){
initialise whole bunch of stuff, including EEPROM.reads
functionpointer = mainmenu
}
loop(){
while (functionpointer points to function (x) ){
}
functionpointer=mainmenu
}
Onto the problem. EEPROM.read has been giving me grief in that I CAN read and write in the setup period to and from EEPROM no problem. Have verified it by selecting option z from main menu and checking values read from EEPROM are correct.
Issue # 1 - reading and saving a float value using a particular variable name EG. classX.varName constantly crashed the arduino when going setting functionpointer to run mode in main menu.
Solution - Change the variable name... seriously.. WTF?? Program works fine now.
Issue # 2 (well after solving issue # 1) reading and saving from EEPROM in general crashed the arduino. Solution was to simply comment out the read and write code and do without EEPROM. Not very practical as I need to use EEPROM. So I tried tracking down the cause. Was my function pointer going a bit skwiffy, or was it just the floats causing the problem (it wasn't, even a simple byte read/save crashed the board), was it a program flow error? Answer, don't know as it has now started working perfectly well off it's own accord....
I should also point out I am experiencing ISR issues WRT simply incrementing a counter variable causing a runtime crash/lockup and for now am using millis() to time events.
I even used the freeRam() function to check how much ram I have left during program execution, and while a little on the low side, it's still above 1.4 / 1.5K which should still be plenty of room for the stack to play right?
Sooo, has anyone had issues similar to this with the EEPROM and what could be the underlying issue? Im starting to become a little suspect about power from the USB, but that wouldn't explain how it could read and write without corruption only to cause a crash once the main program got underway.
As reqards the ISR causing lockups/crashes, I'm a little stumped on that one. ![]()