7 years, 10 months ago.

TinyGPSplus on Hexiwear to get GPS co-ordinates

Hi, I'm trying to get the latitude and longitude values on mbed for Hexiwear platform. This is my sample code.

  1. include "mbed.h"
  2. include "main.h" Include the TinyGPS++ library TinyGPSPlus tinyGPS; Create a TinyGPSPlus object

DigitalOut myled(LED_BLUE); Serial pc(USBTX, USBRX); Serial gps( PTD3,PTD2); void Init() { gps.baud(9600); pc.baud(115200);

} int main() { Init(); while (true) { if(gps.readable()) { tinyGPS.encode(gps.read()); printGPSinfo(); } } } void printGPSinfo() { pc.printf("Latitude:"); pc.printf(tinyGPS.location.lat(), 6); pc.printf("Longitude:"); pc.printf(tinyGPS.location.lng(), 6); } I copied the header file from this location: https://github.com/mikalhart/TinyGPSPlus/blob/master/TinyGPS%2B%2B.h

I tried importing the TinyGPS library in the program tree also. I removed the line which includes Arduino.h. main.h is my tinyGPS library. I'm getting the following errors.

Error: Identifier "millis" is undefined in "main.h", Line: 65, Col: 46 Error: Identifier "millis" is undefined in "main.h", Line: 113, Col: 49 Error: Identifier "millis" is undefined in "main.h", Line: 161, Col: 49 Error: Identifier "millis" is undefined in "main.h", Line: 211, Col: 46 Error: Identifier "millis" is undefined in "main.h", Line: 251, Col: 46 Error: Identifier "millis" is undefined in "main.h", Line: 341, Col: 46 Error: The #if for this directive is missing in "main.h", Line: 493, Col: 3 Error: Function "mbed::Stream::read" (declared at <a href="#" onmousedown="mbed_doc_goto('/Hexi_Serial_Exampleextras/mbed-os.lib/hal/api/Stream.h', '53'); return false;">/extras/mbed-os.lib/hal/api/Stream.h:53</a>) is inaccessible in "main.cpp", Line: 25, Col: 31 Error: Too few arguments in function call in "main.cpp", Line: 25, Col: 36 Error: Identifier "printGPSinfo" is undefined in "main.cpp", Line: 26, Col: 13 Error: Argument of type "double" is incompatible with parameter of type "const char *" in "main.cpp", Line: 36, Col: 38 Error: Argument of type "double" is incompatible with parameter of type "const char *" in "main.cpp", Line: 37, Col: 39 I'm not able to figure out where I went wrong. Please help. Thank You.

Be the first to answer this question.