I have a GPS module that occasionally loses it’s settings and gets reset to the factory defaults. I want my arduino sketch to therefore send the required commands to the GPS to put it back to the settings I want (i.e. update rate, strings that are reported) at start up just in case.
If I connect the GPS to my PC and load up a terminal program (such as the arduino serial monitor or realterm), I can see that if I just send to the GPS the plain string “$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29” nothing happens. If I choose the option to also send “new line” and “carriage return”, the GPS listens, and changes to the right setting.
OK cool, so in my sketch, I should just be able to use the “Serial.println” command right? The reference page (http://arduino.cc/en/Serial/Println) says “Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or ‘\r’) and a newline character (ASCII 10, or ‘\n’)”.
Simple right? Here’s my code:
Serial.println("$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29"); // report GGA every update
So of course it doesn’t work.
I’ve also tried this:
Serial.print("$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29"); // report GGA every update
Serial.print('\n');
Serial.print('\r');
No luck either.
Any ideas? There is obviously something the terminal programs are doing that I’m not.
Thanks!