This is currently what I have. I like to have more than one struct value so as to keep things organized in my mind:
struct config_settings { //these are stored in EEPROM @ 50
int accel; //(516 orginally) Offset for the accelerometer when setting level
int gyro; //(467 orginally) Offset for the gyro when setting level
}
offset;
struct config_steering { //these are stored in EEPROM @ 25
int center; //the value of the steering potentiometer in the center position
}
steering;
So then I can refer to them like:
steering.center
...or
offset.gyro
my question is: Since I only have one variable in the struct called steering, can I skip the struct, and just use a normal variable, like "steeringVal", and yet still use the writeAnything utility to save it to memory. I currently do this:
EEPROM_writeAnything(25, steering); //save the steering settings to EEPROM @ 25
Could I skip the struct thing and just do this?
int steeringVal = analogRead(steeringPin);
EEPROM_writeAnything(25, steeringVal); //save the steering settings to EEPROM @ 25
I think it is not good programming to use two different structures at fixed EEPROM locations.
You can use normal variables at fixed locations, but since you are using structures, you can also organize the structure in the way you like. You could make for example make a new structure that contains the two other structures.
I have used it with individual variables and it works fine. You just need to make sure not to put 2 variables at the same EEPROM address and you have to space the address far enough apart to not step on each other. But otherwise it works fine.