The PgmPrint and PgmPrintln functions in the SD library provided with Arduino 1.0 do not work properly. The SerialPrint_P function in SdFatUtil.h uses Serial.print() to print single characters but needs to be changed to Serial.write() due to the changes to Serial in 1.0. Instead of printing the string, a series of numbers is printed due to the change in printing the value of a byte instead of the byte itself with the print method.
Is the problem with the SD library that comes with Arduino 1.0?
Yes, I was upgrading a program I wrote with Arudino 22 and the SDFat library. I switched to the provided SD library with Arduino 1.0 and encountered the problem. Changing the SerialPrint_P function as below addressed the issue.
static NOINLINE void SerialPrint_P(PGM_P str) {
for (uint8_t c; (c = pgm_read_byte(str)); str++) Serial.write(c);
}
Would you mind creating an issue for this problem...
http://code.google.com/p/arduino/issues/list
I suggest including a link to this topic.
Issue 759 opened - thanks for pointing out the proper place to open.
Thank you.
Is there any reason to use PgmPrint("text") when we have Serial.print(F("text")) other than a few less characters to type? Thanks.