GPS LinkIt One

628

6

4

Posted

Introduction: GPS LinkIt One

This is part two of my LinkIt One GPS Tutorial. I have made a script that sends a serial link that will display the location on google maps.

Step 1: Upload Code and Plug in GPS Antenna

Here Is The Code I Made, It makes a URL for you to copy and enter into your web browser to show the gps location


#include<LGPS.h>

gpsSentenceInfoStructinfo;

charbuff[256];

staticunsignedchargetComma(unsignedcharnum,constchar*str){

unsignedchari,j=0;

intlen=strlen(str);

for(i=0;i<len;i++){if(str[i]==',')j++;

if(j==num)returni+1;

}return0;

}

staticdoublegetDoubleNumber(constchar*s){charbuf[10];

unsignedchari;

doublerev;i=getComma(1,s);

i=i-1;strncpy(buf,s,i);

buf[i]=0;

rev=atof(buf);

returnrev;

}

staticdoublegetIntNumber(constchar*s){charbuf[10];

unsignedchari;

doublerev;i=getComma(1,s);

i=i-1;

strncpy(buf,s,i);buf[i]=0;

rev=atoi(buf);returnrev;

}

voidparseGPGGA(constchar*GPGGAstr){

doublelatitude;

doublelongitude;

inttmp,hour,minute,second,num;

tmp=getComma(2,GPGGAstr);

latitude=getDoubleNumber(&GPGGAstr[tmp]);

tmp=getComma(4,GPGGAstr);

longitude=getDoubleNumber(&GPGGAstr[tmp]);

sprintf(buff,"https://www.google.com/maps/@%10.4f,%10.4f,17z",latitude,longitude);

//%10.4fSerial.println(buff);}

voidsetup(){// put your setup code here, to run once:

Serial.begin(115200);

LGPS.powerOn();

Serial.println("LGPS Power on, and waiting ...");

delay(3000);}

voidloop(){

LGPS.getData(&info);

parseGPGGA((constchar*)info.GPGGA);

delay(2000);}

Step 2: Map

Copy ONE url from the serial monitor and past it into your web browser on the map should be a image of where you LinkIt one Board is!!

Step 3: Need Help?

click here for help

Share

Recommendations

  • Epilog Challenge 9

    Epilog Challenge 9
  • Sew Warm Contest 2018

    Sew Warm Contest 2018
  • Gluten Free Challenge

    Gluten Free Challenge
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

4 Comments

My serial monitor is not working help needed pls help me

Thank you for your efforts but it didn't worked, but then also Thank you.

Hey, Sorry for this late response. Did you switch the Serial Port?