[SOLVED] Why when I pull an EEPROM index the value returned is garbage?

Hello, I have an array of colors for my tft screen:

const uint16_t colorTheme [] PROGMEM = {BLACK, WHITE, NAVY, CYAN, RED, GREEN, VERDEAQ, PINK, ORANGE, PURPLE, GRAY, YELLOW};

When I try to use

colorTheme [EEPROM.read (2500)]

I am returned with a value of any garbage, or a value of 0, and I checked it in read_eeprom and the value of EEPROM.read (2500) is equal to 4, and 4 in mine vector is cyan color, not black or 0 number, why does this go so wrong?

PROGMEM and EEPROM are two different storage locations.

You're forgetting that PROGMEM can't be accessed directly like that

("pgm_read" and all that)

You're using a 2560, right?

The compiler doesn't keep track of what variables are in PROGMEM and what variables are in RAM. Unless you call the special functions to read from PROGMEM you will get whatever is in RAM at that address.

See: PROGMEM - Arduino Reference

TheMemberFormerlyKnownAsAWOL:
You're forgetting that PROGMEM can't be accessed directly like that

("pgm_read" and all that)

You're using a 2560, right?

Yes, i'm using atmega 2560

Please provide a small example code (that will compile) and exhibits the behaviour. So we can see how you're using colorTheme [EEPROM.read (2500)]

LukeDaniel19:
Yes, i'm using atmega 2560

You forgot to react on

TheMemberFormerlyKnownAsAWOL:
You're forgetting that PROGMEM can't be accessed directly like that

("pgm_read" and all that)

So that means that you understand what (ex)AWOL is saying?

Thank you all, my error was solved with the functions to get progmem data, i solved it like this: pgm_read_word(&(colorsTheme[EEPROM.read(address)]))