GPS test

Dependencies:   mbed GYSFDMAXB

main.cpp

Committer:
cocorlow
Date:
2021-04-06
Revision:
1:020b393621e5
Parent:
0:f7f81e36e9d7
Child:
3:25e3289b0411

File content as of revision 1:020b393621e5:

#include "mbed.h"
#include <string.h>
#include "GYSFDMAXB.hpp"

Serial pc(USBTX, USBRX);
GYSFDMAXB gps(PC_12, PD_2);

void Display()
{
    pc.printf("################################\r\n");
    pc.printf("%d h %d m %d s %d ms\r\n", gps.Hours, gps.Minutes, gps.Seconds, gps.Milliseconds);
    pc.printf("%d / %d / %d\r\n", gps.Year, gps.Month, gps.Day);
    pc.printf("latitude  : %c %f\r\n", gps.N_S, gps.Latitude);
    pc.printf("longitude : %c %f\r\n", gps.E_W, gps.Longitude);
    pc.printf("elevation : %f\r\n", gps.Elevation);
    gps.Calcurate();
    pc.printf("Local X : %f\r\n", gps.Position.x);
    pc.printf("Local Y : %f\r\n", gps.Position.y);
    pc.printf("Local Z : %f\r\n", gps.Position.z);
}

int main()
{
    pc.baud(115200);
    Ticker ticker;
    ticker.attach(&Display, 0.3);
    gps.CalcurateUnit();
    
    while (1)
    {
        gps.Update();
    }
}


// GPS baud rate
/*
Serial gps(PC_12, PD_2);
int main()
{
    gps.baud(9600);
    while (1)
    {
        gps.printf("$PMTK251,57600*2C\r\n");
    }
}
*/

/*
$PMTK251,115200*1F\r\n
$PMTK251,57600*2C\r\n
$PMTK251,9600*17\r\n
*/