Firstly, im very thankful from the bottom of my heart for making megunolink. This make my works easier than before.
My problem is when using EEPROMStore arduino library with 2d array.
For example, Im trying to put my default config in 'struct' like this in arduino ide:
struct EMFConfiguration
{
byte voltage[3][5];
void Reset()
{
byte voltage [3][5] = {
{1, 2, 3},
{4, 5, 6}
};
}
};
The thing is, the value of the default one are not use by the one i set for eeprom. The value in eeprom is zero for all array.
Am i doing this wrong? Or is there other way to do this. Any help will be appreciated.
Use 2d array in EEPROMStore arduino library
Hi,
The problem is you are create a new variable in the reset function which hides the one in the structure. You want something more like this:
The problem is you are create a new variable in the reset function which hides the one in the structure. You want something more like this:
Code: Select all
struct EMFConfiguration
{
byte voltage[2][3];
void Reset()
{
voltage[0][0] = 1;
voltage[0][1] = 2;
voltage[0][2] = 3;
voltage[1][0] = 4;
voltage[1][1] = 5;
voltage[1][2] = 6;
}
}