I do not know exacly the rigth word but does it exist the way to store a number in arduino that I can read again when I switch on it again?
For example the hours of work of the unit.
thank you in advance
Pietro
Look at the playground for EEPROm and how to use it
I do love my small example fo setUp():
byte byte8ofEEPROM =EEPROM.read( 8);
EEPROM.write(8,byte8ofEEPROM+1);
while(byte8ofEEPROM&1);
There's a handy template for reading and writing any type from and to EEPROM, without having to worry about the type's size.
template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
const byte* p = (const byte*)(const void*)&value;
int i(0);
for (; i < sizeof(value); ++i)
EEPROM.write(ee++, *p++);
return i;
}
template <class T> int EEPROM_readAnything(int ee, T& value)
{
byte* p = (byte*)(void*)&value;
int i (0);
for (; i < sizeof(value); ++i)
*p++ = EEPROM.read(ee++);
return i;
}