Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: gps.cpp
- Revision:
- 1:c142b1682312
- Child:
- 2:639bfe0721a7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gps.cpp Wed Oct 30 01:42:40 2019 +0000 @@ -0,0 +1,56 @@ +#include "mbed.h" +#include "getGPS.h" +#include "math.h" + +Serial pc(USBTX,USBRX); +GPS gps (p27,p28); + + +int main() { + double a; + double b; + double c; + double d; + double distance; + + pc.printf("GPS Start\n"); + + while(1) + { + if(gps.getgps()) + { + a = gps.latitude; + b = gps.longitude; + + pc.printf("(%lf,%lf)\n\r",gps.latitude,gps.longitude);//緯度と経度を表示 + break; + } + else + { + pc.printf("NO DATA\r\n");//データ取得失敗 + wait(1); + } + } + while(1) + { + if(gps.getgps()) + { + c = gps.latitude; + d = gps.longitude; + pc.printf("(%lf,%lf)\n\r",gps.latitude,gps.longitude);//緯度と経度を表示 + distance =6370*cos(sin(a)*sin(c)+cos(a)*cos(c)*cos(b-d)); + + if (distance<5) + { + }else + { + pc.printf("5m clear!"); + break; + } + }else{ + pc.printf("NO DATA\r\n");//データ取得失敗 + wait(1); + } + } + return 0; + } \ No newline at end of file