Is it possible for an external program running on a PC to read and change data in the EEPROM memory via the USB while a sketch is running on an Arduino? The data in the EEPROM is used by the Arduino sketch for display and calculations. Would I require an interrupt in the sketch when the USB becomes active or would a test in the sketch loop be better?
Any advice appreciated.
I believe avrdude can program the EEPROM. However, the bootloader must be running. So no, you cannot externally program the EEPROM while a sketch is running.
You could only do this with cooperation from your sketch, but the code would be relatively simple. The sketch would need to test for input being available on the serial port, read and validate the commands from the PC and then make the corresponding update to EEPROM.
PeterH:
You could only do this with cooperation from your sketch, but the code would be relatively simple. The sketch would need to test for input being available on the serial port, read and validate the commands from the PC and then make the corresponding update to EEPROM.
Thank you! Are you aware of any code examples?
You'd have to stitch together two types of programs, one that takes a serial input and another that writes values to EEPROM. Check the examples section, you should find examples of both.
Sorry, I meant Tutorials. Here is a link to reading keyboard inputs, for example. Reading Eeproms is described here while writing to them is described here.
Constantin:
Sorry, I meant Tutorials. Here is a link to reading keyboard inputs, for example. Reading Eeproms is described here while writing to them is described here.
Thank you very much!
Glad I could help. Not that it's a likely issue, but keep in mind that EEPROMs can only be written over 100,000 times per the specifications.