Problem using PROGMEM with pointer to an int array

171 views Asked by At

my arduino nano drives an LED Matrix. evrything works fine. but my "outline path" ist too big for the SRAM, so i try to put it into PROGMEM. Now reading values from this progmem array leads to totally wrong integers. what am i doing wrong?

thx for helping!!

bye andre

void progStarsWarp() {

const static PROGMEM int outlinePath[] = {30, 31, 29, 28, 27, 26, 36, 42, 43, 44, 45, 46, 25, 9, 8, 0, 1, 2, 4, 3, 16, 17, 56, 57, 91, 92, 101, 102, 111, 112, 121, 122, 162, 192, 193, 229, 230, 262, 263, 274, 275, 276, 277, 270, 269, 254, 239, 240, 241, 242, 243, 244, 253, 252, 251, 250, 249, 211, 210, 176, 177, 178, 179, 175, 161, 152, 151, 142, 141, 132, 131, 77, 72, 73, 74, 75, 76, 37, 31};
int *pointerOutlinePath;

FastLED.clear();

for (unsigned int i = 0; i < 79; i++) {
    pointerOutlinePath = &outlinePath[i];
    int test = pgm_read_word(pointerOutlinePath);
    leds.m_LED[outlinePath[test]] = CRGB(getRandomColorValue(), getRandomColorValue(), getRandomColorValue());
}

FastLED.show();
delay(60000);

}

0

There are 0 answers