#include <SoftwareSerial.h>
#include <TinyGPS++.h>
SoftwareSerial gpsSerial(8,9);
TinyGPSPlus gps;
float lattitude,longitude;
void setup() {
gpsSerial.begin(9600);
Serial.begin(9600);
}
void loop()
{
while (gpsSerial.available())
{
int data = gpsSerial.read();
if (gps.encode(data))
{
lattitude = (gps.location.lat());
longitude = (gps.location.lng());
Serial.print ("lattitude: ");
Serial.println (lattitude);
Serial.print ("longitude: ");
Serial.println (longitude);
}
}
}```
I am not recieving the coordinates on my serial monitor even though under the clear sky view
Well even if the GPS was not getting a fix, the serial monitor should be printing something like;
lattitude: 0.00
The reason why you should at least see the above is that if the GPS is actually producing characters that can be read, then there will be NMEA sentences there. So if there are NMEA sentences to be read (regardless of whether the GPS has a fix) encode() should be returning true so that "lattitude 0.00" and "longitude 0.00" ought as minimum to be printed out.
Please post your sketch, using code tags when you do
Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination
In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.
@srnet can you guide me with the full connection and what i need to make the changes according to the images in post 13
i have uno as well let me try with it