I'm working on a project for the arduino uno for which I need multiple constant arrays of bytes. Such an array is initialized like so:
const byte charR[] PROGMEM = {
B01111111,//top half
B01111111,
B01000100,
B01000110,
B01101111,
B00111001,
B00000000,
B01111000,//bottom half
B01111000,
B00000000,
B00000000,
B01111000,
B01111000,
B00000000
};
This array represents the capital letter R. I read the nth byte of this array like so:
nth_byte = pgm_read_word(charR+n);
This is all fine and good so far, but now I need to take it a step further. I need to create the array message[]. I need to use message[] to read byte arrays in a certain sequence. For instance:
message[] = {
charR,
chare,
charp,
charl,
chary,
charspace,
charp,
charl,
chare,
chara,
chars,
chare
};
Each entry in message[] refers to a byte array that represents a character. Notice how multiples appear. This is kind of like a 2-D array, but I want to save progmem by only defining each character once.
How do I properly initialize message[]? Will I need to use pointers for this? How do I properly get the array size or yth byte of the xth entry in message[]?