Hi All,
Im trying to send the data from a VKEL VK2828U7G5LF GPS module to the serial monitor. I have 'borrowed' the code attached from an 'instructable' online,
It wont compile. I get the error message below -
Arduino: 1.6.12 (Windows 7), Board: "Arduino/Genuino Uno"
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:24:0,
from sketch\sketch_feb19c.ino.cpp:1:
C:\Users\HOMECO~1\AppData\Local\Temp\untitled1018368005.tmp\sketch_feb19c\sketch_feb19c.ino: In function 'String checkGPS()':
sketch_feb19c:55: error: converting to 'String' from initializer list would use explicit constructor 'String::String(int, unsigned char)'
return false;
^
exit status 1
converting to 'String' from initializer list would use explicit constructor 'String::String(int, unsigned char)'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
This is an error beyond my experience! Can anyone tell me whats going wrong? and, ideally, how to fix it?
Code below-
#include <SoftwareSerial.h>
// GPS Setup
#define rxGPS 3
#define txGPS 5
SoftwareSerial serialGPS = SoftwareSerial(rxGPS, txGPS);
String stringGPS = "";
void setup() {
pinMode(rxGPS, INPUT);
pinMode(txGPS, OUTPUT);
Serial.begin(9600);
Serial.println("Started");
// GPS Setup
serialGPS.begin(4800);
digitalWrite(txGPS,HIGH);
// Cut first gibberish
while(serialGPS.available())
if (serialGPS.read() == '\r')
break;
}
void loop()
{
String s = checkGPS();
if(s && s.substring(0, 6) == "$GPGGA")
{
Serial.println(s);
}
}
// Check GPS and returns string if full line recorded, else false
String checkGPS()
{
if (serialGPS.available())
{
char c = serialGPS.read();
if (c != '\n' && c != '\r')
{
stringGPS = c;
}
else
{
if (stringGPS != "")
{
String tmp = stringGPS;
stringGPS = "";
return tmp;
}
}
}
return false;
}