![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Lab9
Dependencies: mbed HeptaBattery SDFileSystem HeptaCamera_GPS Hepta9axis HeptaTemp HeptaXbee
Diff: main.cpp
- Revision:
- 11:ee677103137d
- Parent:
- 10:4d6870d0caa0
--- 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