Hi,
I'm trying to use EEPROM.set() to write a struct in the rom, but when I use EEPROM.get() and print the data, the value is completely different than what I expect.
here's an example of what I'm trying to do:
struct RGBColor
{
int r;
int g;
int b;
};
void setup()
{
RGBColor colWrite;
colWrite.r = 128;
colWrite.g = 0;
colWrite.b = 0;
EEPROM.put(0, colWrite);
RGBColor colRead;
EEPROM.get(0, colRead);
Serial.println(colRead.r); // outputs 1073741520 instead of 128
}
So like I said, I put a value of 128 in col.r, but the value I get back from a get is 1073741520
What am I doing wrong?
Ah yeah sorry about that, I messed up when I made the example code to be easy to read (now edited).
The actual code is correct and I get the wrong result.