title: Display NEO 6M data in Bluetooth Terminal with ESP32
body: <p>I am building a GPS tracker that sends the position data to an android with Bluetooth and displays the info in the Terminal. </p>
  
  <p>I am trying to use TinyGPS++ library to parse the data to more readable text. I can print the NEO 6M raw data in the Monitor and in the Bluetooth Terminal, but I only get 0 values when using the TinyGPSPlus to display data. I want to see the position updated every 5 seconds. </p>
  
  <p>How can I print the location every 5 seconds in the Bluetooth Terminal?</p>
  
  <p>The output of this code, both on the Bluetooth Terminal and on the Monitor, is:</p>
  
  <pre><code>LONG = 0.000 
  ALT = 0.000 
  SATs = 0 
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>#include "BluetoothSerial.h"
  #include &lt;TinyGPS++.h&gt;
  
  BluetoothSerial ESP_BT;
  TinyGPSPlus gps;
  
  #define GPS_RXD2 16
  #define GPS_TXD2 17
  
  char datGPS=' ';
  int incoming;
  int OUTLED = 2;
  
  void setup() {
  
      Serial.begin(9600);
      Serial2.begin(9600, SERIAL_8N1, GPS_RXD2, GPS_TXD2);
      Serial.println("Serial Txd is on pin: "+String(GPS_TXD2));
      Serial.println("Serial Rxd is on pin: "+String(GPS_RXD2));
  
      ESP_BT.begin("BLE-GPS-Tracker"); //Name of your Bluetooth Signal
      Serial.println("Bluetooth Device is Ready to Pair");
  
      pinMode (OUTLED, OUTPUT);
  }
  
  void loop() {
      while (Serial2.available()) {
          datGPS = char(Serial2.read());
          Serial.print(datGPS);
          ESP_BT.print(datGPS);
          gps.encode(Serial2.read());
  
          static unsigned long lastTime = 0;
          if (millis() - lastTime &gt;= 5000) {
              lastTime = millis();
              Serial.print("LAT=");  Serial.println(gps.location.lat(), 3);
              Serial.print("LONG="); Serial.println(gps.location.lng(), 3);
              Serial.print("ALT=");  Serial.println(gps.altitude.meters());
              Serial.print("SATs="); Serial.println(gps.satellites.value());
  
              ESP_BT.print("LAT=");  ESP_BT.println(gps.location.lat(), 3);
              ESP_BT.print("LONG="); ESP_BT.println(gps.location.lng(), 3);
              ESP_BT.print("ALT=");  ESP_BT.println(gps.altitude.meters());
              ESP_BT.print("SATs="); ESP_BT.println(gps.satellites.value());
          }
      }
  
      if (ESP_BT.available())
      {
      incoming = ESP_BT.read();
      Serial.print("Received:");
      Serial.println(incoming);
  
      if (incoming == 49)
          {
          digitalWrite(OUTLED, HIGH);
          ESP_BT.println("LED turned ON");
          }
  
      if (incoming == 48)
          {
          digitalWrite(OUTLED, LOW);
          ESP_BT.println("LED turned OFF");
          }
  
      if (Serial2.available())
          {
          ESP_BT.println(char(Serial2.read()));
          }    
      }
  delay(5);  
  }
  </code></pre>