How to store 10 digit Serial No in AT24C32 in ESP32

Hi,

I am trying to store EEPROM Values and it works for most of the normal numbers upto long. (4 bytes of Data).

I have a specific requirement of Storing 10 Digit Serial No. starting with 99XXXXXX99 and mismatch flag generated if new device is inserted with new serial no.

I am afraid maximum value of Long in arduino is 4,294,967,295 < My requirement.

so what could be the most efficient way of doing it ?

1 Like

I'd not use EEPROM with a ESP32 instead use,

ESP32 Preferences

EEPROM on the ESP32 has been depreciated.

1 Like

is that 10-digit serial number actually represented in a single variable within your code, or is it represented as an array of ASCII digits?

if ASCII, you could save the 10 ASCII values in the EEPROM.

if that's not good enough, you could save pairs of digits as a single byte (5 bytes total)

1 Like

If your serial always starts from "99", you can easily drop the leading digits and put the rest to uint32 variable

1 Like

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