EEPROM Workshop Video Chapter 4.4

My question is in regards to the EEPROM Chapter 4.4 of online workshops. I copied the example code that was presented in the video onto my Arduino NANO. (by the way the include statement is missing the <EEPROM.h> part of the statement) I also built the circuit shown in the video. It works just like the video shows in that it increases the count every time the button is pushed. When I push the reset button the count is indeed saved and the count continues uninterrupted. However, when I unplug the USB cable from the Arduino or my computer (simulating a power failure) the count restarts at one. It seems that the EEPROM does not retain the count after a power loss. Any suggestions or comments as what is happening. Thanks in advanced. Brad

Hi Brad,

I’m not sure what the problem you are experience might be. I just tested the code on an Arduino and everything works as expected. It’s worth noting that if you hit the reset button, then remove the USB it resets to zero.

Thanks for pointing out the error in the code. I’ve corrected it on the workshop!

1 Like

Hi Stephen,

Thanks for responding to my question. I will try it again. I am trying to count cycles with my Arduino nano. The counter that I am using has 5 digits so the count can eventually reach 99,999. I am also confused if your example can only count using a single address that will only hold the binary digit 11111111. I kind of got the impression that I could use the entire EEPROM memory to just continue counting. If you have any examples as to how to do this I would certainly appreciate it.

Thanks again for answering so quickly. I like the way you present your videos. I plan on watching the entire workshop series.

Brad

Hi Brad,

Each address can only hold one byte (0-255). If you try to store a larger number it will not work. You will need to create a system to store your number between addresses. Keep in mind that each address can be written to only about 100,000 each, then will stop working. You will get no error or notification that they have worn out other than your data not being saved. If you are counting so high you will need to find a way to write as little as possible, and not reused worn out addresses. Here is an example that iterates through addresses:
https://www.norwegiancreations.com/2017/02/using-eeprom-to-store-data-on-the-arduino/

There might be an easier way. Make sure you are using the latest version of Arduino IDE and then experiment with

These will allow any object type to be saved/read to/from EEPROM.

1 Like

Graham,

Thanks for your tip. I will certainly try using the EEPROM commands you suggested. Thanks for the comment.

Brad

Stephen,

I checked out the link you provided and found it to be very helpful. Thanks again for you help.

Brad

1 Like