printing data from gps on Serial1 and sensors into Serial 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(&quot;Hello there&quot;);

Here is the code
  if (Serial1.available() &gt; 0) {
    gps.encode(Serial1.read());
    if (gps.location.isUpdated()){
      Serial.println(&quot;Satellite Count:&quot;);
      Serial.println(gps.satellites.value());
      Serial.println(&quot;Latitude:&quot;);
      Serial.println(gps.location.lat(), 6);
      Serial.println(&quot;Longitude:&quot;);
      Serial.println(gps.location.lng(), 6);
      Serial.println(&quot;Speed KT:&quot;);
      Serial.println(gps.speed.knots());
      Serial.println(&quot;Altitude Feet:&quot;);
      Serial.println(gps.altitude.feet());
      Serial.println(&quot;&quot;);
    }
  }
  Serial.println(&quot;Hello there&quot;);

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
This looks like another case of serial spam.  I recommend changing to a frame-based approach and controlling that rate with checks to millis.
That limits the spam.  Alternative is to limit it outright to 1:
//a static global:
static int isaidHELLO = 0;

//later in the loop
if (Serial1.available() &gt; 0) {
    gps.encode(Serial1.read());
    if (gps.location.isUpdated()){
      Serial.println(&quot;Satellite Count:&quot;);
      Serial.println(gps.satellites.value());
      Serial.println(&quot;Latitude:&quot;);
      Serial.println(gps.location.lat(), 6);
      Serial.println(&quot;Longitude:&quot;);
      Serial.println(gps.location.lng(), 6);
      Serial.println(&quot;Speed KT:&quot;);
      Serial.println(gps.speed.knots());
      Serial.println(&quot;Altitude Feet:&quot;);
      Serial.println(gps.altitude.feet());
      Serial.println(&quot;&quot;);
      isaidHELLO = 0;
    }
  }
  if(isaidHELLO == 0)
  {
      Serial.println(&quot;Hello there&quot;);
      isaidHELLO = 1;
  }