Introduction: GPS LinkIt One

Picture of 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

Picture of 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

Picture of 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

Comments

Aditya Tripathi (author)2015-10-24

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?

About This Instructable

555views

6favorites

License:

Bio: I like to create new things! I'm very interested in IOT and just Internet Stuff. I am not responsible for any injury or deaths ... More »
More by Funguypro:3D Print Your House!!!!!DIY Raspberry Pi Indoor Outdoor WebcamSee Through Buildings With a Drone
Add instructable to: