![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Hepta UplinkData
Dependencies: mbed PowerControl SDFileSystem
Fork of Hepta_UplinkData by
main.cpp
- Committer:
- tomoya123
- Date:
- 2016-12-13
- Revision:
- 0:b96079b7d167
- Child:
- 1:2a3dc618aef7
File content as of revision 0:b96079b7d167:
#include "mbed.h" #include "HeptaXbee.h" #include "HeptaAccel.h" #include "HeptaBattery.h" Serial pc(USBTX,USBRX); HeptaXbee xbee(p9, p10);//(tx,rx)=(Din,Dout) HeptaBattery battery(p16,p29,p26); HeptaAccel accel(p28,p27,0x38); //ピンアサイン読み込み、オブジェクトの生成 int main() { pc.baud(9600); xbee.baud(9600); xbee.printf("Xbee Uplink Ok Mode\r\n"); int rcmd=0,cmdflag=0; char ddata[16],acx[4],acy[4],acz[4],bat[4];//変数の定義 int dsize[2]; for(int i=1;i<10;i++){ xbee.printf("num = %d\r\n",i); xbee.xbee_recieve(&rcmd,&cmdflag); pc.printf("rcmd=%d,cmdflag=%d\r\n",rcmd,cmdflag); if(cmdflag==1){ if(rcmd=='a'){ xbee.printf("Command Get%d\r\n"); for(int j=1;j<10;j++){ accel.sensing_u16(acx,acy,acz,&dsize[0]); battery.vol_u16(bat,&dsize[1]); xbee.xbee_s_transmit(ddata,16,acx,acy,acz,bat, dsize[0],dsize[0],dsize[0],dsize[1]); } } xbee.initialize(); } wait (1.0); } }