Audrino Uno EEPROM question

Hi,

I am using an Audrino Uno with a fingerprint sensor and a TFT display. I have a ID counter which runs every time I run the code and the user tries to enroll a fingerprint, so this data is stored in that specific ID. For example: at the start the ID value is 1 and the first user who enrolls gets the data stored in ID1 and this goes on.
The issue I have is when I turn off the audrino or reset it, the ID value reinitiates again from 1 and erases the last fingerprint which was stored in ID=1 and stores the new fingerprint.
In order to resolve that I was thinking on using the EEPROM. I was thinking of using an counter with EEPROM address as 1 and ID as 1, so the counter keeps incrementing and storing the data in respective addresses. So I am back to the old issue where how would I continue from the last stored Address after power cycle/reset?
Can someone point out to an example?

Retrieve the value saved by EEPROM.put() by using EEPROM.get() in setup().

Look at the EEPROM library examples in the IDE, too.

A tutorial.

1 Like

Thanks a ton for the idea.
I was able to use that and coupled it with another logic where I could wrote sentinel value to the EEPROM locations initially say 255. Then as I handled the fingerprints I replaced that 255 with other values. When the code started, it would just scan through EEPROM looking for the first location containing 255, and that's the next one to use.

Or, preferably, EEPROM.update() to prevent unnecessary rewrites of identical values causing unnecessary wear of the EEPROM.

The EEPROM.put() reference says:

This function uses EEPROM.update() to perform the write, so does not rewrites the value if it didn't change.

Ah, I confused put and write. My bad!

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