Retreiving data from flash after boot


the http://www.arduino.cc/en/reference/progmem has clear example of how save , load int value in flash memory.

but reading data makes use of variable charset (initiliased when writing it) address:

code: [select]

progmem  prog_uint16_t charset[]  = {65000};

unsigned int displayint;
int k;    // counter variable

// read 2-byte int
displayint = pgm_read_word_near(charset + k)


how can read data without knowing address?

for example (hypothetical case)

code: [select]


unsigned int displayint;

// read 2-byte int
displayint = pgm_read_word_near(charset + 0)

if (digitalread(button) == 1){
value = displayint + 1;    //some value based upon value retrieved flash
progmem  prog_uint16_t charset[]  = {value};
}

this give errors because charset not known @ first call

code: [select]
progmem  prog_uint16_t charset[]  = {analogread(analogpin)};
that doesn't make sense.


Arduino Forum > Using Arduino > Programming Questions > Retreiving data from flash after boot


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

listen to event