Hi:
Tried to follow some guidelines, I even copied and pasted a portion of code but when the values are read, they are not the same as should have been saved.
I need to save 6 values from around 1000 and 2000 (yes RC pulse values). I understand that values are saved as bytes, so I must divide by 256 for the highbyte and store the remain for the lowbyte.
This is the code I use to write:
void writeChannelSetting(uint8_t nIndex,uint16_t unSetting)
{
EEPROM.write(nIndex*sizeof(uint16_t),lowByte(unSetting));
EEPROM.write((nIndex*sizeof(uint16_t))+1,highByte(unSetting));
}
But the code that reads the values does this:
void readSettingsFromEEPROM()
{
minPulseWidthThr = readChannelSetting(EEPROM_INDEX_minPulseWidthThr); (etc.)
It seems to be reading just one byte. Is it enough to have one index per value? If the value takes two bytes, shouldn't I read two indexed positions?
is there any working example storing and reading values greater than one byte?