chars and arrays

I found this 2x2 array of bytes that represent 7x7 bits to draw fonts...

I made a library so that I could include it:

uint8_t cp437_font [256] [8] PROGMEM = {
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // 0x00
...

The letter 'A' is this:
{ 0x7C, 0x7E, 0x13, 0x13, 0x7E, 0x7C, 0x00, 0x00 }, // 'A'

Thus
cp437_font[65][0] returns 0x7C, which is 124 in decimal.

I was testing, by doing this:

Serial.println(cp437_font['A'][0]);

Yet, when I do this:
int message[] = {
'A' };
for (int i = 0; i < message_length; i++) {
int character = message*;*

  • Serial.println(character);*
  • Serial.println(cp437_font[character][0]);*
  • Serial.println(cp437_font['A'][0]);*
  • }*
    I get this:
    65
    76
    124
    ------
    Well, last night I was getting this:
    65
    0
    124
    ------
    Am I doing something wrong indexing the array?
    I expect the 124, not the zero.

The usual about posting full code, not just snippets, and using the CODE tags.

Yet, when I do this:

Then, don't do that. First, http://snippets-r-us.com is the place to go for help with snippets. Second, code MUST be posted in code tags (read the sticky that you didn't bother reading) so that the forum software doesn't interpret it. I'm sure your snippet doesn't look like that.

Third, there are functions for accessing data in PROGMEM. The Serial.print() overload knows about how to access the data. Your snippet does not.

Apparently, my problem has to do with the PROGMEM thing, as if I remove that, my code works as I would expect. I've been reading up on this PROGMEM thing, but I still don't understand what I am seeing.

jonwa:
but I still don't understand what I am seeing.

Hey, at least you're seeing something. I'll I'm seeing is mangled and incomplete code.

Further to your private message to me: Impossible to tell from snippets like that. You have to post the lot.

How to use this forum

Read this before posting a programming question

Code tags.