Multi-Dimensional Arrays problem

Here's a ref guide for you: PROGMEM - Arduino Reference

And a working example.

const byte prog[2][2] PROGMEM = { {1, 2}, {3, 4} };

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      Serial.print(F("prog["));
      Serial.print(i);
      Serial.print(F("]["));
      Serial.print(j);
      Serial.print(F("] = "));
      Serial.println(pgm_read_byte_near(&prog[i][j]));
    }
  }
}

void loop() { }
1 Like