Writing variables?
Hello,
I am in the process of building a maze solving BOE-bot and I want my robot to remember the maze layout after the first trial so it can simply go through the maze quickly for the next trials. I therefore need a way to store variables after the robot makes it out of the maze during the first trial so it can remember the layout for subsequent trials. Any suggestions on how to do this? Can I use the READ/WRITE commands in my code to automatically write variables to EEPROM after it makes it out of the maze?
I am in the process of building a maze solving BOE-bot and I want my robot to remember the maze layout after the first trial so it can simply go through the maze quickly for the next trials. I therefore need a way to store variables after the robot makes it out of the maze during the first trial so it can remember the layout for subsequent trials. Any suggestions on how to do this? Can I use the READ/WRITE commands in my code to automatically write variables to EEPROM after it makes it out of the maze?
Comments
First, if you write to an eeprom to frequently you can wear it out. So keeping volatile state in RAM and then writing to the eeprom after it is more stable is the way to go.
Second, you should reserve space in the eeprom for the amount of data you intend to write using Pbasic data statements. If you don't the risk of overwriting your program with your data.
True that, but we're talking about millions of write cycles before any damage is done. Very unlikely to get into trouble unless you have buggy code that mistakenly writes & rewrites in an endless loop.
True, but I just wanted to alert him to the issue.
That's surprisingly easy to run into. Had a bug in my thermostat code once that lead to me adding many many thousands of write cycles when it ran off the end of a variable and began running the updateLog routine every cycle instead of once every 1hr.
That's my special talent.... doing things others find improbable and breaking something in ways nobody ever saw coming