test

Dependencies:   Hepta9axis HeptaBattery HeptaCamera_GPS HeptaTemp HeptaXbee SDFileSystem mbed

Fork of Lab9-01_All_transmit by HEPTA-Sat Training 2017~2018

Files at this revision

API Documentation at this revision

Comitter:
HEPTA
Date:
Tue Sep 05 09:17:43 2017 +0000
Parent:
10:4d6870d0caa0
Commit message:
All Transmit Mode

Changed in this revision

HeptaCamera_GPS.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 4d6870d0caa0 -r ee677103137d HeptaCamera_GPS.lib
--- a/HeptaCamera_GPS.lib	Mon Sep 04 16:37:49 2017 +0000
+++ b/HeptaCamera_GPS.lib	Tue Sep 05 09:17:43 2017 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/HEPTA/code/HeptaCamera_GPS/#591580af98be
+https://developer.mbed.org/users/HEPTA/code/HeptaCamera_GPS/#d4ecef9ef8fd
diff -r 4d6870d0caa0 -r ee677103137d main.cpp
--- a/main.cpp	Mon Sep 04 16:37:49 2017 +0000
+++ b/main.cpp	Tue Sep 05 09:17:43 2017 +0000
@@ -14,12 +14,33 @@
 HeptaTemp temp(p17);
 HeptaBattery bat(p16,p26);
 
-DigitalOut myled(LED1);
-
 int main()
 {
-    myled = 1;
-    wait(0.5);
-    myled = 0;
-    wait(0.5);
+    int rcmd=0,cmdflag=0;
+    while(1) {
+        wait(1.0);
+        xbee.xbee_recieve(&rcmd,&cmdflag);
+        pc.printf("rcmd=%d, cmdflag=%d\r\n",rcmd, cmdflag);
+        if (cmdflag == 1) {
+            pc.printf("Command Get %d\r\n",rcmd);
+            pc.printf("HEPTA Uplink OK\r\n");
+            if(rcmd == 'h') {
+                cam_gps.gps_setting();
+                char gx[4],gy[4],gz[4],ax[4],ay[4],az[4],mx[4],my[4],mz[4],lad[8],log[8],height[4],bt[4],temper[4];
+                char ddata[64];
+                int dsize[7];
+                for(int i = 0;i < 50;i++) {
+                    n_axis.sen_gyro_u16(gx,gy,gz,&dsize[0]);
+                    n_axis.sen_acc_u16(ax,ay,az,&dsize[1]);
+                    n_axis.sen_mag_u16(mx,my,mz,&dsize[2]);
+                    bat.vol_u16(bt,&dsize[5]);
+                    temp.temp_sense_u16(temper,&dsize[6]);
+                    cam_gps.lat_log_sensing_u16(lad,log,height,&dsize[3],&dsize[4]);
+                    xbee.putc('H');
+                    xbee.xbee_transmit(ddata,64,gx,gy,gz,ax,ay,az,mx,my,mz,lad,log,height,bt,temper,dsize[0],dsize[0],dsize[0],dsize[1],dsize[1],dsize[1],dsize[2],dsize[2],dsize[2],dsize[3],dsize[3],dsize[4],dsize[5],dsize[6],14);
+                }
+            }
+            xbee.initialize();
+        }
+    }
 }
\ No newline at end of file