#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! ^^