I am having some trouble using my gps (on Serial1) with my other sensors.
They both work great independently but when I use them in the same code, it's either the gps or the sensors that get to write on the Serial monitor.
For my gps I am using TinyGPS++, but I have a feeling that's not what's causing this problem here.
To simplify the code I'll be replacing what the sensors are supposed to write with this:
Serial.println("Hello there");
Here is the code
if (Serial1.available() > 0) {
gps.encode(Serial1.read());
if (gps.location.isUpdated()){
Serial.println("Satellite Count:");
Serial.println(gps.satellites.value());
Serial.println("Latitude:");
Serial.println(gps.location.lat(), 6);
Serial.println("Longitude:");
Serial.println(gps.location.lng(), 6);
Serial.println("Speed KT:");
Serial.println(gps.speed.knots());
Serial.println("Altitude Feet:");
Serial.println(gps.altitude.feet());
Serial.println("");
}
}
Serial.println("Hello there");
I get this
Hello there
Hello there
Hello there
Hello there
Hello there
Hello there
Hello there
Hello there
Hello there
Hello there
Hello there
Hello there
Hello there
Hello there
If the line is removed, I get this
Satellite Count:
5
Latitude:
xx.xxxxx
Longitude:
-xx.xxxxxx
Speed KT:
0.19
Altitude Feet:
331.69
Thank you
if
block ... addserial.println ( millis() );
before "Satellite Count:" .... add one also at "Hello there"