I was helped enormously by others in a former topic - in particular one commentator suggested that I use the dtostrf function to get the full Lat-Long decimal points. This I tried and managed to get a successful serial printout showing data with the expected layout in terms of columns, but no real GPS data (Figure 1).
Figure 1
0, 0.00000, 0.00000, 0, 0,
0, 0.00000, 0.00000, 0, 0,
0, 0.00000, 0.00000, 0, 0,
0, 0.00000, 0.00000, 0, 0,
My apologies if I have missed something very simple, but help would be greatly appreciated on ways of securing live data from the GPS [programme attached]. I should say that the GPS picks up and presents credible data using another programme.
/*
* Rui Santos
* Complete Project Details http://randomnerdtutorials.com
*Based on the example TinyGPS++ from arduiniana.org; adapted by CH
*
*/
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <stdlib.h>
static const int RXPin = 8, TXPin = 9;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;// The TinyGPS++ object
SoftwareSerial ss(RXPin, TXPin);// The serial connection to the GPS device
//--------------------------dtostrf-insert---------------------------------------------
static float f_val1 = (gps.location.lat());///value of sensor [f-val]
static float f_val2 = (gps.location.lng());///value of sensor [f-val]
static char outstr1[15];//stors char.
static char outstr2[15];//stors char.
int Alt;
int Sat;
int Date;
//-------------------------------------------------------------------------------------
void setup(){
//------------------------------dtostrf-insert-----------------------------------------
dtostrf(f_val1,7, 5, outstr1);//converts f-val(float)to a char array
dtostrf(f_val2,7, 5, outstr2);//converts f-val(float)to a char array
Alt = (gps.altitude.meters());
Sat = (gps.satellites.value());
Date = (gps.date.value());
Serial.begin(9600);
ss.begin(GPSBaud);///////////////from origional programme
}
//-------------------------------------------------------------------------------------
void loop(){
// This sketch displays information every time a new sentence is correctly encoded.
while (ss.available() > 0){
//------------------------------dtostrf-insert-----------------------------------------
Serial.print(Date);
Serial.print(", ");
Serial.print(outstr1);
Serial.print(", ");
Serial.print(outstr2);
Serial.print(", ");
Serial.print(Sat);
Serial.print(", ");
Serial.print(Alt);
Serial.println(", ");
delay(400);
}
}