Closed
Description
I believe that reading the char array from PROGMEM at url https://www.arduino.cc/en/Reference/PROGMEM is incorrect.
In the block of code;
// read back a char
for (k = 0; k < strlen(signMessage); k++)
{
myChar = pgm_read_byte_near(signMessage + k);
Serial.print(myChar);
}
strlen can not be used on signMessage, but strlen_P should be used instead which works correctly. As a secondary and for efficiency, the string length need not be calculated on every iteration of the for loop but can be calculated outside;
// read back a char
int len = strlen_P(signMessage);
for (k = 0; k < len; k++)
{
myChar = pgm_read_byte_near(signMessage + k);
Serial.print(myChar);
}
Regards,
Adam Palmer
http://www.iodigitalsec.com/