![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Lab9
Dependencies: mbed HeptaBattery SDFileSystem HeptaCamera_GPS Hepta9axis HeptaTemp HeptaXbee
main.cpp@11:ee677103137d, 2017-09-05 (annotated)
- Committer:
- HEPTA
- Date:
- Tue Sep 05 09:17:43 2017 +0000
- Revision:
- 11:ee677103137d
- Parent:
- 10:4d6870d0caa0
All Transmit Mode
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:bdbd3d6fc5d5 | 1 | #include "mbed.h" |
mbed_official | 0:bdbd3d6fc5d5 | 2 | #include "SDFileSystem.h" |
umeume | 2:1c5cdb2c3e0f | 3 | #include "HeptaXbee.h" |
umeume | 2:1c5cdb2c3e0f | 4 | #include "HeptaCamera_GPS.h" |
umeume | 2:1c5cdb2c3e0f | 5 | #include "Hepta9axis.h" |
umeume | 2:1c5cdb2c3e0f | 6 | #include "HeptaTemp.h" |
umeume | 2:1c5cdb2c3e0f | 7 | #include "HeptaBattery.h" |
umeume | 2:1c5cdb2c3e0f | 8 | |
umeume | 2:1c5cdb2c3e0f | 9 | Serial pc(USBTX,USBRX); |
HEPTA | 9:942eb6e8c117 | 10 | SDFileSystem sd(p5, p6, p7, p8, "sd"); |
umeume | 2:1c5cdb2c3e0f | 11 | HeptaXbee xbee(p9,p10); |
umeume | 2:1c5cdb2c3e0f | 12 | HeptaCamera_GPS cam_gps(p13, p14,p25,p24); |
HEPTA | 10:4d6870d0caa0 | 13 | Hepta9axis n_axis(p28,p27,0xD0,0x18); |
HEPTA | 7:fab080b8be64 | 14 | HeptaTemp temp(p17); |
umeume | 2:1c5cdb2c3e0f | 15 | HeptaBattery bat(p16,p26); |
umeume | 2:1c5cdb2c3e0f | 16 | |
umeume | 2:1c5cdb2c3e0f | 17 | int main() |
umeume | 2:1c5cdb2c3e0f | 18 | { |
HEPTA | 11:ee677103137d | 19 | int rcmd=0,cmdflag=0; |
HEPTA | 11:ee677103137d | 20 | while(1) { |
HEPTA | 11:ee677103137d | 21 | wait(1.0); |
HEPTA | 11:ee677103137d | 22 | xbee.xbee_recieve(&rcmd,&cmdflag); |
HEPTA | 11:ee677103137d | 23 | pc.printf("rcmd=%d, cmdflag=%d\r\n",rcmd, cmdflag); |
HEPTA | 11:ee677103137d | 24 | if (cmdflag == 1) { |
HEPTA | 11:ee677103137d | 25 | pc.printf("Command Get %d\r\n",rcmd); |
HEPTA | 11:ee677103137d | 26 | pc.printf("HEPTA Uplink OK\r\n"); |
HEPTA | 11:ee677103137d | 27 | if(rcmd == 'h') { |
HEPTA | 11:ee677103137d | 28 | cam_gps.gps_setting(); |
HEPTA | 11:ee677103137d | 29 | 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]; |
HEPTA | 11:ee677103137d | 30 | char ddata[64]; |
HEPTA | 11:ee677103137d | 31 | int dsize[7]; |
HEPTA | 11:ee677103137d | 32 | for(int i = 0;i < 50;i++) { |
HEPTA | 11:ee677103137d | 33 | n_axis.sen_gyro_u16(gx,gy,gz,&dsize[0]); |
HEPTA | 11:ee677103137d | 34 | n_axis.sen_acc_u16(ax,ay,az,&dsize[1]); |
HEPTA | 11:ee677103137d | 35 | n_axis.sen_mag_u16(mx,my,mz,&dsize[2]); |
HEPTA | 11:ee677103137d | 36 | bat.vol_u16(bt,&dsize[5]); |
HEPTA | 11:ee677103137d | 37 | temp.temp_sense_u16(temper,&dsize[6]); |
HEPTA | 11:ee677103137d | 38 | cam_gps.lat_log_sensing_u16(lad,log,height,&dsize[3],&dsize[4]); |
HEPTA | 11:ee677103137d | 39 | xbee.putc('H'); |
HEPTA | 11:ee677103137d | 40 | 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); |
HEPTA | 11:ee677103137d | 41 | } |
HEPTA | 11:ee677103137d | 42 | } |
HEPTA | 11:ee677103137d | 43 | xbee.initialize(); |
HEPTA | 11:ee677103137d | 44 | } |
HEPTA | 11:ee677103137d | 45 | } |
umeume | 2:1c5cdb2c3e0f | 46 | } |