Go Down

Topic: PROGMEM variable reference call! (Read 420 times) previous topic - next topic


Hi there! I am trying to create a small arduino code that can pull some flash memory data based on a variable reference from a string

This is how i define one of my flash memory variable:

Code: [Select]
char H0[] PROGMEM = "01000010";
char H1[] PROGMEM = "01000010";
char H2[] PROGMEM = "01000010";
char H3[] PROGMEM = "01111110";
char H4[] PROGMEM = "01000010";
char H5[] PROGMEM = "01000010";
char H6[] PROGMEM = "01000010";
char H7[] PROGMEM = "01000010";
PGM_P H[8] PROGMEM= {H0,H1,H2,H3,H4,H5,H6,H7};

//this is my string
char string[ ] = "HHH";

now, i am trying to load the string variable with data from the PGM_P H[8] array, so for instance when i scan the string, i would get 3 characters of "H" and based on that i would like to load the H[8] variable from the flash memory, does anybody know a simple way to do this?

Thanks in advance, and i hope my explication was clear enough on what i am trying to achieve! Ovidiu

Go Up