Multidimentional arrays

be80be

Well-Known Member
I never been much good at a Multidimentional arrays And I can't get how to address them
Like this
Code:
const byte indexTable[26][8] ={
{B00110000,B01001000,B10000100,B10000100,B11111100,B10000100,B10000100,B10000100} //A
,{B11111000,B10000100,B10000100,B11111000,B11111000,B10000100,B10000100,B11111000} //B
,{B00111000,B01000100,B10000000,B10000000,B10000000,B10000000,B01000100,B00111000} //C
,{B11110000,B10001000,B10000100,B10000100,B10000100,B10000100,B10001000,B11110000} //D
,{B11111100,B10000000,B10000000,B11100000,B11100000,B10000000,B10000000,B11111100} //E
,{B11111100,B10000000,B10000000,B11110000,B11110000,B10000000,B10000000,B10000000} //F
,{B00111000,B01000100,B10000100,B10000000,B10011000,B10000100,B01000100,B00111000} //G
,{B10000100,B10000100,B10000100,B10000100,B11111100,B10000100,B10000100,B10000100} //H
,{B11111110,B00010000,B00010000,B00010000,B00010000,B00010000,B00010000,B11111110} //I
,{B11111110,B00010000,B00010000,B00010000,B00010000,B10010000,B10010000,B01100000} //J
,{B10000100,B10001000,B10010000,B11100000,B11100000,B10010000,B10001000,B10000100} //K
,{B10000000,B10000000,B10000000,B10000000,B10000000,B10000000,B10000000,B11111100} //L
,{B10000010,B11000110,B10101010,B10010010,B10000010,B10000010,B10000010,B10000010} //M
,{B10000010,B11000010,B11100010,B10110010,B10011010,B10001110,B10000110,B10000010} //N
,{B00110000,B01001000,B10000100,B10000100,B10000100,B10000100,B01001000,B00110000} //O
,{B11110000,B10001000,B10000100,B10001000,B11110000,B10000000,B10000000,B10000000} //P
,{B00110000,B01001000,B10000100,B10000100,B10000100,B10000100,B01001000,B00110100} //Q
,{B11110000,B10001000,B10000100,B10001000,B11110000,B10001000,B10000100,B10000100} //R
,{B01110000,B10001000,B00001000,B00110000,B01000000,B10000000,B10001000,B01110000} //S
,{B11111110,B00010000,B00010000,B00010000,B00010000,B00010000,B00010000,B00010000} //T
,{B10000100,B10000100,B10000100,B10000100,B10000100,B10000100,B01001000,B00110000} //U
,{B10000100,B10000100,B10000100,B10000100,B10000100,B10000100,B01001000,B00110000} //V
,{B10000010,B10000010,B10000010,B10000010,B10000010,B10010010,B01010100,B00101000} //w
,{B10000010,B01000100,B00101000,B00010000,B00010000,B00101000,B01000100,B10000010} //X
,{B10000010,B01000100,B00101000,B00010000,B00010000,B00010000,B00010000,B00010000} //Y
,{B11111100,B00000100,B00001000,B00010000,B00010000,B00100000,B01000000,B11111100} //Z
};
How would I print roll D, O,G
If I could figure just that one part I'd have is whiped.
 
This get's me a D
Code:
for(byte j = 0; j < 8; j++){
  
      delay(500);
  Serial.println(indexTable[4][j],BIN);
But when I try to cast 4 to the next roll it doesn't run the for loops but 3 times and it takes 8 to send out the 8 bytes
 
Last edited:
My goal is to be able to print text using print(It is all good) and send out the 8 bytes to make each letter.
char Str[ ] = "It is all good";
Code:
for (int j = 0; j < 8; j++){
   Serial.println(indexTable[i] [j]);
   delay(500);
I can't for the life of me figure how to update i with the next letter.
 
Last edited:
Hi Burt. Could something like this work?

Code:
  void putChr(char letter)      //
  { for(int j = 0; j < 8; j++)  //
    { Serial.println(indexTable[letter-'A'][j]);
      delay(500);               //
    }                           //
  }                             //

  void putStr(rom char *strg)   //
  { char ndx = 0;               //
    while(wreg = strg[ndx++])   //
      putChr(wreg);             //
  }                             //
Code:
  putStr("It is all good");
 
If I could figure how to use it with C++
Code:
void printLetter::letter (byte c)
{
  if (c < 0x41 || c > 0x5A)
    c = 0x5A;  // unknown letter
  c -= 0x41; // force into range of our font table (which starts at 0x41)
  // font data is in PROGMEM memory (firmware)
  for (byte x = 0; x < 8; x++)
    Serial.write (pgm_read_byte (&font [c] [x]));
}  // end of printLetter::letter
 
It still don't work keyword letter is in lcd library. I'm wanting a stand alone code calling my table.
 
Wow Ian, you are a venerable fountain of knowledge. I am always impressed by your vast knowledge base.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…