![]() |
Save a variable
Is there a way to save a value in a program after the power had been lost and then recover the value after the power is reaplied? :ahh:
Thanks ^_^' |
Re: Save a variable
Yes, you can use the EEPROM on the RC. Check out this thread for details and code that will let you do it. Be aware that you can't write to the EEPROM every loop in the RC or you'll wear it out.
|
EEPROM Lifetimes
As far as I know (not an expert by any means), most EEPROMs are good for at least a million write cycles. So don't go writing to it every cycle, but every second should be fine.
|
Re: EEPROM Lifetimes
Quote:
Once per second gives 277 hours, longer, probably longer than you will need for the robot. But depending on the variable, it could be longer. How often does the variable change? if it is not that often, you could detect when it changes, and then save it. |
Re: EEPROM Lifetimes
Quote:
What I had in mind, however, was a variable that is constantly changing (like position, for example), but you don't want to exhaust your EEPROM. So you write only every second. That gives you reasonably up-to-date information, but many fewer write cycles, greatly extending the life of your EEPROM. |
Re: EEPROM Lifetimes
honestly, i think your best bet would be to have a button to save the value that you should press before you turn it off-- that saves a lot of writes, even though it requires user intervention
|
Re: EEPROM Lifetimes
Quote:
|
Re: EEPROM Lifetimes
Quote:
|
| All times are GMT -5. The time now is 02:11. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi