Cannot run GPS Program

#include "taskFlyport.h"
#include "grovelib.h"
#include "gps.h"

void FlyportTask()
{
vTaskDelay(100);
UARTWrite(1,"Welcome to GROVE NEST example!\r\n");

// GROVE board
void *board = new(Board);

// GROVE devices
void *gps = new(Gps,2);//2 Uart module used
attachToBoard(board,gps,DIG2);//Gps is connected to DIG2 port

UARTWrite(1,"GPS....\r\n");
while(1)
{
vTaskDelay(200);
if(set(gps))//update the GPS data
UARTWrite(1,"GPS not connected\n\r");
if(readError())
UARTWrite(1,"GPS data error\n\r");
else
{
lon = get(gps,LONGITUDE);
lat = get(gps,LATITUDE);
year = get(gps,YEAR);
month = get(gps,MONTH);
day = get(gps,DAY);
hour = get(gps,HOUR);
min = get(gps,MINUTE);
sec = get(gps,SECOND);
speed = get(gps,SPEED);
sprintf(msg,"lat %f,\n\rlong %f,\n\ryear %d,\n\rmonth %d,
\n\rday %d,\n\rhour %d,\n\rmin %d,\n\rsec %d\n\rspeed %f\n\r",
(double)lat,(double)lon,year,month,day,hour,min,sec,(double)speed);
UARTWrite(1,msg);
}
}
}

The code above is taken from AskGeek.io and for some reason I can't seem to get it to work... Any solutions will be welcomed! Thank you! ^^

Are you getting anything from the GPS - can you write a simpler sketch to echo what the GPS outputs to the Serial Monitor?

(Please get into the habit of using code tags when posting code)

Even though Microchip is buying Atmel, I don't think arduino.cc is quite ready to support PIC products yet. :slight_smile:

You would probably get more help on the related OpenPIC forum.

Good luck!
/dev

P.S. That code! I need to take a few aspirin.

/dev:
Even though Microchip is buying Atmel, I don't think arduino.cc is quite ready to support PIC products yet. :slight_smile:

You would probably get more help on the related OpenPIC forum.

Good luck!
/dev

P.S. That code! I need to take a few aspirin.

@/dev, thank you so much! ^^

AWOL:
Are you getting anything from the GPS - can you write a simpler sketch to echo what the GPS outputs to the Serial Monitor?

(Please get into the habit of using code tags when posting code)

@AWOL, sorry, I am new to codes and all. Not very sure what you mean by 'getting anything from the GPS' but if you mean if the GPS works, it does :smiley: I tried running another code for it and it works perfectly fine. But that code prints out too much info and I only need the latitude and longitude from the GPS...