Array of bytes in PROGMEM

Hello!
this is my first post here :slight_smile: i hope i posted it in the right section.
I am a beginner with Arduino too

I am trying for two long days to learn how to store variables in PROGMEM and use them, but i can’t get this to work. The following example works fine if i remove PROGMEM and switch back to read the struct array directly.

How do i set it to read those bytes from PROGMEM right?
It compiles but read weird/wrong data

#include <avr/pgmspace.h>
#include "LedControl.h"

//DataIn, CLK, LOAD, single MAX72XX.
LedControl lc=LedControl(12,11,10,1);


void setup() {
  Serial.begin(9600);
  lc.shutdown(0,false);
  lc.setIntensity(0,8);
  lc.clearDisplay(0);
}

typedef struct  {
  String charName;
  byte charBytes[8];
} CustomCharacter;

static const CustomCharacter mxlChr[] PROGMEM = {
{"smiley",{B01000010,B10100101,B10100101,B01000010,B00000000,B10000001,B01000010,B00111100}},//0
{"arrow_L",{0b00011000,0b00110000,0b01100000,0b11111111,0b11111111,0b01100000,0b00110000,0b00011000}},//1
{"arrow_R",{0b00011000,0b00001100,0b00000110,0b11111111,0b11111111,0b00000110,0b00001100,0b00011000}},//2
{"M",{B10000001,B11000011,B10100101,B10011001,B10000001,B10000001,B10000001,B10000001}},
{"A",{B00011000,B00100100,B01000010,B01000010,B01111110,B11000011,B10000001,B10000001}},
{"X",{B10000001,B01000010,B00100100,B00011000,B00011000,B00100100,B01000010,B10000001}},
{"sound",{B00001100,B00000010,B01001001,B11000101,B11000101,B01001001,B00000010,B00001100}},
};

 
void writeCustomChar(int c) {  
    lc.clearDisplay(0);
    for(int r=0; r<8; r++){
      byte lcdrow = pgm_read_byte(mxlChr[c].charBytes[r]);
      Serial.println(lcdrow);
      //byte lcdrow = mxlChr[c].charBytes[r];
      lc.setColumn(0,r,lcdrow);
    }
}


//examples
//lc.setRow(0,row,B10100000);
//lc.setColumn(0,col,B10100000);
//lc.setLed(0,row,col,false);


void loop() { 
  for(int c=0; c<7; c++){
    writeCustomChar(c);
    delay(1000);
  }
}

The purpose: I am trying to do a little code to write custom glyphs on a 8x8 led matrix, that i previously defined in that array, because nothing i found so far works so i decided to make my own.
…and also because i want to learn how to store large amounts of organized data.

Any advice or fix for this is most welcome

Thank you very much!

This doesn’t show anything in the serial monitor.
Where is the & in byte lcdrow = pgm_read_byte(mxlChr
```c
**.charBytes[r]);[/b]

This however, does.
byte lcdrow = pgm_read_byte(&mxlChr[c].charBytes[r]);

If you want to see exactly what you’re getting, you can do this.
Serial.println(lcdrow, BIN); // this will show the value in binary and it should also match what you have in the array.**
```

Thank you for the reply.
I am still fighting with this. Eventually i made the code without using progmem , its working, but eventually i will run out of memory and will need to find ugly alternate ways to avoid that (like dividing the functionality over two arduinos)

If anyone could tell me how i can actually use PROGMEM in the above example , it would be absolutely awesome. The way you sugested HazardMinds is showing on serial "0" but does nothing useful. I tried various other ways in the meantime and i didn't get anything better.

Basically what i want to do is access a structures values that are stored in progmem

Thank you a lot

Please post your new code and your attempt to solve the issue in your first code.