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
main.cpp@0:04793043db60, 2019-10-25 (annotated)
- Committer:
- KINU
- Date:
- Fri Oct 25 11:39:17 2019 +0000
- Revision:
- 0:04793043db60
gps
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| KINU | 0:04793043db60 | 1 | #include "mbed.h" |
| KINU | 0:04793043db60 | 2 | #include "getGPS.h" |
| KINU | 0:04793043db60 | 3 | Serial pc(USBTX,USBRX); |
| KINU | 0:04793043db60 | 4 | GPS gps (p27,p28); |
| KINU | 0:04793043db60 | 5 | |
| KINU | 0:04793043db60 | 6 | |
| KINU | 0:04793043db60 | 7 | int main() { |
| KINU | 0:04793043db60 | 8 | double a; |
| KINU | 0:04793043db60 | 9 | double b; |
| KINU | 0:04793043db60 | 10 | double c; |
| KINU | 0:04793043db60 | 11 | double d; |
| KINU | 0:04793043db60 | 12 | double distance; |
| KINU | 0:04793043db60 | 13 | |
| KINU | 0:04793043db60 | 14 | pc.printf("\r\n\GPS Start\r\n"); |
| KINU | 0:04793043db60 | 15 | |
| KINU | 0:04793043db60 | 16 | while(2){ |
| KINU | 0:04793043db60 | 17 | if(gps.getgps()){ |
| KINU | 0:04793043db60 | 18 | a = gps.latitude; |
| KINU | 0:04793043db60 | 19 | b = gps.longitude; |
| KINU | 0:04793043db60 | 20 | |
| KINU | 0:04793043db60 | 21 | pc.printf("(%lf,%lf)\n\r",gps.latitude,gps.longitude);//緯度と経度を表示 |
| KINU | 0:04793043db60 | 22 | break; |
| KINU | 0:04793043db60 | 23 | }else{ |
| KINU | 0:04793043db60 | 24 | pc.printf("NO DATA\r\n");//データ取得失敗 |
| KINU | 0:04793043db60 | 25 | wait(1); |
| KINU | 0:04793043db60 | 26 | } |
| KINU | 0:04793043db60 | 27 | while(2){ |
| KINU | 0:04793043db60 | 28 | if(gps.getgps(){ |
| KINU | 0:04793043db60 | 29 | c = gps.latitude; |
| KINU | 0:04793043db60 | 30 | d = gps.longitude; |
| KINU | 0:04793043db60 | 31 | pc.printf("(%lf,%lf)\n\r",gps.latitude,gps.longitude);//緯度と経度を表示 |
| KINU | 0:04793043db60 | 32 | distance = (a-c)*(a-c)+(b-d)*(b-d); |
| KINU | 0:04793043db60 | 33 | |
| KINU | 0:04793043db60 | 34 | if (distance<25){ |
| KINU | 0:04793043db60 | 35 | }else{ |
| KINU | 0:04793043db60 | 36 | pc.printf("5m動いたミニマムサクセスクリア"); |
| KINU | 0:04793043db60 | 37 | break; |
| KINU | 0:04793043db60 | 38 | |
| KINU | 0:04793043db60 | 39 | }else{ |
| KINU | 0:04793043db60 | 40 | pc.printf("NO DATA\r\n");//データ取得失敗 |
| KINU | 0:04793043db60 | 41 | wait(1); |
| KINU | 0:04793043db60 | 42 | } |
| KINU | 0:04793043db60 | 43 | return 0; |
| KINU | 0:04793043db60 | 44 | } |