Flashee-eeprom only storing one value?

I’m having a bit of a confusing issue. I try this:

#include "flashee-eeprom/flashee-eeprom.h"
using namespace Flashee;
FlashDevice* flash;

void setup() {
    Serial1.begin(4800);
    FlashDevice* flash = Devices::createDefaultStore();

    flash->write(42,10);
    flash->write(564,12);

    int readout;
    flash->read(readout,10);
    Serial1.println(readout);

    flash->read(readout,12);
    Serial1.println(readout);
}

void loop() {
}

This prints:

36962346
564

No matter what code I run, writing floats, erasing the flash, trying CreateAddressErase, anything, I only get one valid value.

What’s going on?

I’ve figured out a much easier workaround to my problem;

Just store a whole list of values if you need multiple addresses:

int list_thing = {5,5,6,8,61,23,132,5};
flash->write(list_thing,10);

int on this 32bit system are 4 byte long, not two as your addresses suggest.

You should keep track of the next free address by use of something like newaddress = oldaddress + sizeof(oldVar) and not assume the actual size of your used variables.

1 Like

Aha! Yes! I was thinking that flashee handled that with the address parameter, but I guess not. Thanks!