I have defined a byte array as a constant in the Atmel's flash memory:
const uint8_t eye [] PROGMEM = {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
};
How can I (repeatedly) read the length of this constant in the program? All the available functions in avr/pgmspace.h do not deliver the proper length, no matter how I use them. I tried strlen(eye), strlen_P(eye), strLen_PF(eye) and also sizeof(eye). I'm new to C, so I'm not sure about the whole pointer stuff.
sizeof()
, when provided with a pointer to a const (or a pointer to anything else for that matter), which is what you have when you pass it to a function, gives you the size of that pointer. On an 8-bit Arduino that will always be 2.strlen()
only works on strings - null-terminated arrays, which that isn't.