title: How to read gps data continuously using arduino pro mini
body: <p>I am working on a project where i capture the temperature &amp; humidity, gps, and gyrometer data and construct a json out of all these and send to serial port. I am able to do for the temeperature, humidity and gyrometer, but not able to get the data from the GPS. </p>
  
  <p>Modules used are </p>
  
  <ol>
  <li>DHT11 for temperature and humidity</li>
  <li>ADXL for gyrometer readings</li>
  <li>GY NMEO6MV2 for GPS </li>
  </ol>
  
  <p>This is the code snippet for GPS</p>
  
  <pre><code>#include &lt;dht.h&gt;
  #include &lt;TinyGPS++.h&gt;
  #include &lt;SoftwareSerial.h&gt;
  static const int RXPin = 4, TXPin = 3;
  static const uint32_t GPSBaud = 9600;
  TinyGPSPlus gps;
  dht DHT;
  // The serial connection to the GPS device
  SoftwareSerial ss(RXPin, TXPin);
  // Defining pin for humidity sensor
  #define DHT11_PIN 7
  // Defining pin for ADXL Analog pins
  const int xPin = 3;
  const int yPin = 4;
  const int zPin = 5;
  //ADXL Data
  double x,y,z;
  // Defining Static values ADXL. TO CHANGE AS NEEDED
  int xStatic = 504;
  int yStatic = 493;
  int zStatic = 617;
  void setup()
  {      
    //int error;
    //uint8_t c;
    Serial.begin(19200);
    ss.begin(GPSBaud);
  }
  void loop()
  {
    //int error;
    //double dT;
    //char buffer[100];
    //read the analog values from the accelerometer
    int xRead = analogRead(xPin);
    int yRead = analogRead(yPin);
    int zRead = analogRead(zPin);
    x = xStatic - xRead;
    y = yStatic - yRead;
    z = zStatic - zRead;
    //Serial.print("{\"x\":");
    Serial.print(x);
    Serial.print("#");
    //Serial.print(",\"y\":");
    Serial.print(y);
    Serial.print("#");
   //Serial.print(",\"z\":");
   Serial.print(z);
   //DHT
   if (int chk = DHT.read11(DHT11_PIN)) {
     Serial.print("#");
     //Serial.print(",\"temperature\":");
     Serial.print(DHT.temperature);
     Serial.print("#");
     //Serial.print(",\"humidity\":");
     Serial.print(DHT.humidity);
   }
   while (ss.available() &gt; 0)
      if (gps.encode(ss.read()))
         if(gps.location.isValid())
         {
          //Serial.print(",\"latitude\":");
            Serial.print("#");
            Serial.print(gps.location.lat(), 6);
         // Longitude in degrees (double)
          //Serial.print(",\"longitude\":");
            Serial.print("#");
            Serial.print(gps.location.lng(), 6);
         //DATE
            String date;
            // Day (1-31) (u8)
            date= gps.date.day();
            // Month (1-12) (u8)
            date+= "-";
            date+= gps.date.month();
            // Year (2000+) (u16)
            date+= "-";
            date+= gps.date.year();
            //Serial.print(",\"date\":");
            Serial.print("#");
            Serial.print("\""+date+"\"");
            //TIME
            String time;
            // Hour (0-23) (u8)
            time= gps.time.hour();
            time+= ":";
            // Minute (0-59) (u8)
            time+= gps.time.minute();
            time+= ":";
            // Second (0-59) (u8)
            time+= gps.time.second();
            time+= ":";
            // 100ths of a second (0-99) (u8)
            time+= gps.time.centisecond();
            //Serial.print(",\"time\":");
            Serial.print("#");
            Serial.print("\""+time+"\"");
            //GPS SPEED AND ALTITUDE
            // Speed in kilometers per hour (double)
            Serial.print("#");
            //Serial.print(",\"speed\":");
            Serial.print(gps.speed.kmph());
            //Serial.println("}");
            //Serial.println("$");
            delay(2000);
     }
     Serial.print("$");
     delay(3000);
     if (millis() &gt; 5000 &amp;&amp; gps.charsProcessed() &lt; 10)
     {
       Serial.println(F("No GPS detected: check wiring."));
       while(true);
     }
  
   }
  </code></pre>
  
  <p>The values are not coming continuously from the gps.
  Can any one help me out in this regard.
  Thanks in advance</p>