Hello,
I need help with my project.
Any help appreciated!
#include <TinyGPS++.h>
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <WiFiNINA.h>
#include <BlynkSimpleWiFiNINA.h>
char auth[] = "********";
// Set password to "" for open networks.
char ssid[] = "********";
char pass[] = "********";
WidgetMap myMap(V0);
BlynkTimer timer;
TinyGPSPlus gps;
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// If you want to remove all points:
//myMap.clear();
int index = 1;
float lat = 51.5074;
float lon = 0.1278;
myMap.location(index, lat, lon, "value");
timer.setInterval(2000L, myTimerEvent4); //2sec timer
}
void myTimerEvent4() {
Blynk.run();
// This sketch displays information every time a new sentence is correctly encoded.
while (Serial1.available() > 0)
if (gps.encode(Serial1.read()))
displayInfo();
}
void displayInfo() {
if (gps.location.isValid()) {
lat = gps.location.lat(); //get latitude and longitude
lon = gps.location.lng();
Blynk.virtualWrite(V12, 1, lat, lon, "car"); //write to Blynk map
//create location string which can be used directly in Google maps
slocation = String(lat) + "," + String(lon);
spd = gps.speed.kmph(); //get speed
Blynk.virtualWrite(V13, spd);
bearing = TinyGPSPlus::cardinal(gps.course.value()); //direction
Blynk.virtualWrite(V14, bearing);
sats = gps.satellites.value(); //get number of satellites
Blynk.virtualWrite(V15, sats);
hdop = gps.hdop.value() / 10; //get accuracy of location
Blynk.virtualWrite(V16, hdop);
msg5 = "GPS Good";
Blynk.virtualWrite(V11, msg5);
}
else
{
msg5 = "Invalid Data";
Blynk.virtualWrite(V11, msg5);
}
}
void loop()
{
Blynk.run();
timer.run(); // Initiates BlynkTimer
}
ERROR MESSAGE:
Arduino: 1.8.14 Hourly Build 2020/09/14 03:35 (Mac OS X), Board: âArduino MKR WiFi 1010â
sketch/GPS_BLYNK_Yannis.ino.cpp:2:63: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
#line 1 â/Users/yannis/Documents/Arduino/sketch_GPS_WORKING_???/GPS_BLYNK_Yannis/GPS_BLYNK_Yannis.inoâ
/Users/yannis/Documents/Arduino/sketch_GPS_WORKING_???/GPS_BLYNK_Yannis/GPS_BLYNK_Yannis.ino:18:64: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
void setup()
/Users/yannis/Documents/Arduino/sketch_GPS_WORKING_???/GPS_BLYNK_Yannis/GPS_BLYNK_Yannis.ino:19:64: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
{
/Users/yannis/Documents/Arduino/sketch_GPS_WORKING_???/GPS_BLYNK_Yannis/GPS_BLYNK_Yannis.ino:38:64: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
/Users/yannis/Documents/Arduino/sketch_GPS_WORKING_???/GPS_BLYNK_Yannis/GPS_BLYNK_Yannis.ino:47:64: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
if (gps.location.isValid()) {
/Users/yannis/Documents/Arduino/sketch_GPS_WORKING_???/GPS_BLYNK_Yannis/GPS_BLYNK_Yannis.ino:72:64: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
{
/Users/yannis/Documents/Arduino/sketch_GPS_WORKING_???/GPS_BLYNK_Yannis/GPS_BLYNK_Yannis.ino: In function âvoid displayInfo()â:
GPS_BLYNK_Yannis:48:8: error: âlatâ was not declared in this scope
lat = gps.location.lat(); //get latitude and longitude
^~~
/Users/yannis/Documents/Arduino/sketch_GPS_WORKING_???/GPS_BLYNK_Yannis/GPS_BLYNK_Yannis.ino:48:8: note: suggested alternative: âUartâ
lat = gps.location.lat(); //get latitude and longitude
^~~
Uart
GPS_BLYNK_Yannis:49:8: error: âlonâ was not declared in this scope
lon = gps.location.lng();
^~~
/Users/yannis/Documents/Arduino/sketch_GPS_WORKING_???/GPS_BLYNK_Yannis/GPS_BLYNK_Yannis.ino:49:8: note: suggested alternative: âlogâ
lon = gps.location.lng();
^~~
log
GPS_BLYNK_Yannis:52:8: error: âslocationâ was not declared in this scope
slocation = String(lat) + â,â + String(lon);
^~~~~~~~~
GPS_BLYNK_Yannis:53:8: error: âspdâ was not declared in this scope
spd = gps.speed.kmph(); //get speed
^~~
GPS_BLYNK_Yannis:55:8: error: âbearingâ was not declared in this scope
bearing = TinyGPSPlus::cardinal(gps.course.value()); //direction
^~~~~~~
/Users/yannis/Documents/Arduino/sketch_GPS_WORKING_???/GPS_BLYNK_Yannis/GPS_BLYNK_Yannis.ino:55:8: note: suggested alternative: âStringâ
bearing = TinyGPSPlus::cardinal(gps.course.value()); //direction
^~~~~~~
String
GPS_BLYNK_Yannis:57:8: error: âsatsâ was not declared in this scope
sats = gps.satellites.value(); //get number of satellites
^~~~
/Users/yannis/Documents/Arduino/sketch_GPS_WORKING_???/GPS_BLYNK_Yannis/GPS_BLYNK_Yannis.ino:57:8: note: suggested alternative: âpassâ
sats = gps.satellites.value(); //get number of satellites
^~~~
pass
GPS_BLYNK_Yannis:59:8: error: âhdopâ was not declared in this scope
hdop = gps.hdop.value() / 10; //get accuracy of location
^~~~
/Users/yannis/Documents/Arduino/sketch_GPS_WORKING_???/GPS_BLYNK_Yannis/GPS_BLYNK_Yannis.ino:59:8: note: suggested alternative: âloopâ
hdop = gps.hdop.value() / 10; //get accuracy of location
^~~~
loop
GPS_BLYNK_Yannis:61:8: error: âmsg5â was not declared in this scope
msg5 = âGPS Goodâ;
^~~~
GPS_BLYNK_Yannis:66:8: error: âmsg5â was not declared in this scope
msg5 = âInvalid Dataâ;
^~~~
exit status 1
âlatâ was not declared in this scope
This report would have more information with
âShow verbose output during compilationâ
option enabled in File -> Preferences.