Thanks Jason. I think I'm beginning to understand... Let me see if I comprehend the basics of this lesson:
- In
mySerial.print("ASCII Character ");
mySerial.print("?x00?y1"); // move cursor to countdown position
mySerial.print(" Table in 5.. ");
each time a line of code says "mySerial.print(SOMETHING)", the SOMETHING is stored in RAM instead of in the flash memory as a separate constant string where it is called instead of being called from the program itself. With all of the strings in the code, it ate up the RAM pretty quick.
- In your example
#include <avr/pgmspace.h>
// print prompts and messages from program flash to save SRAM
void print_prompt_P(const char *data)
{
while (pgm_read_byte(data) != 0x00)
Serial.print(pgm_read_byte(data++));
}
the subroutine print_prompt_P, along with the command PSTR from the library pgmspace.h allows me to store these strings in the main program memory.
That's kind of cool.
Should I be able to use mySerial.print(pgm_read_byte(data++)); instead of Serial.print(pgm_read_byte(data++)); so that I can use the alternate output pin for the mySerial command?
Thanks again and 73. This information will be good to know -- one of my goals is to make an APRS/packet radio telemetry unit which may involve lots of serial strings out to the TNC (and, of everybody here, I know you know what I'm talking about!)