![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
GPS test
main.cpp
- Committer:
- cocorlow
- Date:
- 2021-04-08
- Revision:
- 3:25e3289b0411
- Parent:
- 1:020b393621e5
- Child:
- 5:8301960b3ae8
File content as of revision 3:25e3289b0411:
#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); pc.printf("UniversalZero X : %f\r\n", gps.UniversalZeroPosition.x); pc.printf("UniversalZero Y : %f\r\n", gps.UniversalZeroPosition.y); pc.printf("UniversalZero Z : %f\r\n", gps.UniversalZeroPosition.z); pc.printf("Universal X : %f\r\n", gps.UniversalPosition.x); pc.printf("Universal Y : %f\r\n", gps.UniversalPosition.y); pc.printf("Universal Z : %f\r\n", gps.UniversalPosition.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 */ /* Serial pc(USBTX, USBRX); Serial gps(PC_12, PD_2); void gps_receive() { while (gps.readable()) { char c; c = gps.getc(); pc.putc(c); } } int main() { pc.baud(115200); gps.baud(57600); gps.attach(gps_receive, Serial::RxIrq); while (1) { } } */ /* $GPGLL,3542.8886,N,13945.7717,E,071533.000,A,A*58 $GPGSA,A,3,21,22,08,194,195,01,,,,,,,2.14,1.90,1.00*07 $GPGSV,4,1,14,195,85,343,35,01,79,276,33,21,69,028,29,194,59,191,33*73 $GPGSV,4,2,14,08,48,067,32,22,47,142,34,14,34,314,16,28,29,316,16*7C $GPGSV,4,3,14,30,28,267,,07,23,224,,27,16,087,,10,03,033,*7C $GPGSV,4,4,14,193,,,,38,,,*4C $GPRMC,071533.000,A,3542.8886,N,13945.7717,E,0.10,53.89,080421,,,A*56 $GPVTG,53.89,T,,M,0.10,N,0.19,K,A*03 $GPZDA,071533.000,08,04,2021,,*58 $GPGGA,071534.000,3542.8886,N,13945.7717,E,1,6,1.90,95.8,M,39.3,M,,*69 $GPGLL,3542.8886,N,13945.7717,E,071534.000,A,A*5F $GPGSA,A,3,21,22,08,194,195,01,,,,,,,2.14,1.90,1.00*07 $GPGSV,4,1,14,195,85,343,35,01,79,276,33,21,69,028,29,194,59,191,33*73 $GPGSV,4,2,14,08,48,067,32,22,47,142,34,14,34,314,16,28,29,316,16*7C $GPGSV,4,3,14,30,28,267,,07,23,224,,27,16,087,,10,03,033,*7C $GPGSV,4,4,14,193,,,,41,,,*42 */