Updating variables on a running program

I have a PID regulator, and when writing the program I can estimate what the values should be, but from time to time, I am way of, and would like to be able to write new values to the PID on site(with display + rotary encoder), without having to connect the board to a PC, new values should stay in the memory/flash if power is turned off/on.

Can that be done?
Or is it only possibly when you compile?

Google : Arduino EEPROM

You have a choice…
You can use buttons and displays, or a serial / remote interface to tweak the values.

When you’re happy, save them in EEPROM, and next time the unit is turned on, read them back.

The external user interface could be unplugged during nor,all operation.

Hi eXistenZ,
(creative chosen username)

Yes this is doable. For a more specific advice on how to code such a functionality you have to provide more information.

WHat is important to know about the EEPROM is the fact that an EEPROM has a limited number of write-cycles. If you reach this limit the the EEPROM wears out and is no longer usable. This limit is 100.000 write-cycles. Seems pretty much and - normal use assumed - plenty enough. But in case of bad programming whcih causes repeated writing to the EEPROM you can wear out the EEPROM within minutes. This means you have to pay attention to very carefully test the EEPROM-write-functions to operate in a non-repetetive manner. You can do this in the development state by disabling the real writing to EEPROM and just print to the serial monitor. If your program runs and the printing to the serial monitor is not creating an endless stream of new lines "writing to EEPROM" you can activate the real writing to EEPROM.

best regards Stefan

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.