kk
Dependencies: SDFileSystem mbed
Fork of cansat_kk by
Diff: main.cpp
- Revision:
- 2:be9046fb5859
- Parent:
- 1:fa44a6246bcc
- Child:
- 3:efaa785283a6
--- a/main.cpp Mon Feb 29 17:05:54 2016 +0000 +++ b/main.cpp Mon Feb 29 18:07:55 2016 +0000 @@ -18,12 +18,14 @@ char gps_data[256]; float longitude,latitude,gpstime,knot,angle; int i=0; +char *gps_target = "$GPRMC,174813.000,A,3606.9349,N,13927.4196,E,0.42,221.65,280216,,,A*6D"; +float longitude_target,latitude_target,gpstime_target,knot_target,angle_target; void gps_rx()//GPSデータ受信割り込み { gps_data[i] = gps.getc(); if( gps_data[i] == '$' ) - { + { //$から受信データを保持する gps_data[0] = '$'; i = 1; @@ -55,7 +57,8 @@ { //改行コードが来るまでカウントを続ける i++; - if(i==255){ + if(i==255) + { pc.printf("*** Error! ***\n"); } } @@ -65,12 +68,32 @@ void move() { //動作 + switch (count) + { + case 0: + if( (target_angle+3)>=angle || (target_angle-3)<=angle ) + { + // + + } + break; + case 1: + 文2; + break; + case 2: + 文n; + break; + default: + 文; + break; + } } int main() { gps.baud(9600); gps.attach(gps_rx, Serial::RxIrq);//GPS割り込み + sscanf(gps_target,"$GPRMC,%f,A,%f,N,%f,E,%f,%f",&gpstime_target,&longitude_target,&latitude_target,&knot_target,&angle_target); while(1) {