Hi, I want to use the flash memory of my Arduino Nano 168, but somehow it gives strange results.
Here is the code:
const prog_uint8_t BitMap[8] = { // store in program memory to save RAM
B10000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
};
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print(BitMap[0]);
Serial.print(" ");
Serial.print(pgm_read_byte (&BitMap[0]));
Serial.print(" ");
}
The values BitMapp[0] and pgm_read_byte (&BitMap[0]) are different.
BitMapp[0] is 128 (correct), but pgm_read_byte (&BitMap[0]) gives 144 and sometimes different depending on where i put the print command.
And why would one need pgm_read_byte at all. Why not just use BitMapp[0]?
thanks..