However, i am unable to succesfully send the command to the GPS sensor. I tried gpsSerial.print and gpsSerial.write, both not working. My code is shown below:
#include "TinyGPS++.h"
TinyGPSPlus gps;
#define gpsSerial Serial1
unsigned long currentTime;
unsigned long lastDisplayTime = 0;
unsigned long test = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
gpsSerial.begin(9600);
delay(3000);
}
void loop() {
// put your main code here, to run repeatedly:
currentTime = millis();
// Constantly feed gps values
while ( gpsSerial.available() > 0) {
gps.encode(gpsSerial.read());
}
if (currentTime - lastDisplayTime >= 500) {
Serial.print("Sats:"); Serial.print(gps.satellites.value()); Serial.print(", ");
Serial.print("Lat:"); Serial.print(gps.location.lat(), 6); Serial.print(", ");
Serial.print("Lon:"); Serial.print(gps.location.lng(), 6); Serial.print(", ");
Serial.print("Time:"); Serial.println(gps.time.value());
lastDisplayTime = currentTime;
}
if (currentTime > 10000 && test == 0){
Serial.println("Put into standby mode");
gpsSerial.write("PMTK225,2,3000,12000,18000,72000");
gpsSerial.print("PMTK225,2,3000,12000,18000,72000");
test = 1;
}
}
Anyone knows the correct sentence to send a command to my GPS module?