void loop(){
while(gpsSerial.available()){ // check for gps data
if(gps.encode(gpsSerial.read())){ // encode gps data
gps.get_position(&lat,&lon); // get latitude and longitude
// display position
Serial.print("Position: ");
Serial.print("lat: ");Serial.print(lat);Serial.print(" ");// print latitude
Serial.print("lon: ");Serial.println(lon); // print longitude
}
}
}
problem is that i not getting any output in serial monitor.
"The only thing you'll need to watch for is that the module is designed to run at about 3.3V, and shouldn't be powered by 5.0V. If you're using an Arduino, simply connect the GPS power pin to the 3.3V pin. If you want to configure the module, you'll want to put a 10K resistor divider on the RX pin so you don't put 5V on the data pin. We include these resistors, as well as a 6 pin header you can solder to the module in order to plug it into a breadboard. "
before you trying getting the tinygps program to work, write a very simple program that
just copies all the data which the gps device sends out, to the serial monitor.
You will then know that the communication is working and the gps is doing "something".
You need to do this outside, or the gps device may never get a proper signal, or may take
hours to do so.
You could connect the output line to an ordinary input pin and see if it waggles with a simple program.
Or connect a scope.
Or connect something to the fix-status pin of the receiver.
AWOL:
You could connect the output line to an ordinary input pin and see if it waggles with a simple program.
Or connect a scope.
Or connect something to the fix-status pin of the receiver.
I'm sure there are, but start from the basics: Is your receiver in line-of-sight with a large area of sky, without any tinted or reflective glass in the way?
#include <SoftwareSerial.h>
SoftwareSerial gpsSerial(2, 3); // create gps sensor connection
void setup(){
Serial.begin(9600); // connect serial
gpsSerial.begin(9600); // connect gps sensor
}
// Just loop forever reading from the GPS and writing it to the Serial Monitor
void loop(){
while(gpsSerial.available()){
Serial.write(gpsSerial.read());
}
}
Depending on location and clear visibility of the Skies "Position Lock" can take up to 5 minutes. IIRC there is a line in the "TinyGPS12.ino, when uncommented will dump the Raw NMEA data to your serial monitor... I've used it, convinced my GPS receiver was broken... It wasn't. It does however take about 5 minutes of CLEAR SKY not heavily cloudy... for the Ephemeris to created in the GPS device and I don't think your device will work without one.
I got disgusted and went to bed... the GPS sketch was working when I awoke.
My GPS sends NMEA sentences even if it is not locked onto any satellites but I have already used the Adafruit sketch to set the update rate and select the sentences.