Lab5

Dependencies:   HEPTA_SENSOR mbed HEPTA_EPS HEPTA_COM HEPTA_CDH

Committer:
HeptaSatTraining2019
Date:
Mon Nov 04 18:48:38 2019 +0000
Revision:
29:894182303c8e
Parent:
26:39867627f3dd

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:bdbd3d6fc5d5 1 #include "mbed.h"
HeptaSatTraining2019 25:5fd40a170032 2 #include "HEPTA_EPS.h"
HeptaSatTraining2019 25:5fd40a170032 3 #include "HEPTA_CDH.h"
HeptaSatTraining2019 25:5fd40a170032 4 #include "HEPTA_SENSOR.h"
HeptaSatTraining2019 25:5fd40a170032 5 #include "HEPTA_COM.h"
umeume 2:1c5cdb2c3e0f 6
umeume 2:1c5cdb2c3e0f 7 Serial pc(USBTX,USBRX);
HeptaSatTraining2019 21:92c25e853b87 8 HEPTA_EPS eps(p16,p26);
HeptaSatTraining2019 25:5fd40a170032 9 HEPTA_CDH cdh(p5,p6,p7,p8,"sd");
HeptaSatTraining2019 26:39867627f3dd 10 HEPTA_SENSOR sensor(p17,
HeptaSatTraining2019 21:92c25e853b87 11 p28,p27,0xD0,0x18,
HeptaSatTraining2019 25:5fd40a170032 12 p13,p14,p25,p24);
HeptaSatTraining2019 21:92c25e853b87 13 HEPTA_COM com(p9,p10);
umeume 2:1c5cdb2c3e0f 14
umeume 2:1c5cdb2c3e0f 15 int main()
umeume 2:1c5cdb2c3e0f 16 {
HeptaSatTraining2019 26:39867627f3dd 17 int rcmd=0,cmdflag=0;
HeptaSatTraining2019 26:39867627f3dd 18 while(1) {
HeptaSatTraining2019 26:39867627f3dd 19 wait(1.0);
HeptaSatTraining2019 26:39867627f3dd 20 com.xbee_receive(&rcmd,&cmdflag);
HeptaSatTraining2019 26:39867627f3dd 21 pc.printf("rcmd=%d, cmdflag=%d\r\n",rcmd, cmdflag);
HeptaSatTraining2019 26:39867627f3dd 22 if (cmdflag == 1) {
HeptaSatTraining2019 26:39867627f3dd 23 pc.printf("Command Get %d\r\n",rcmd);
HeptaSatTraining2019 26:39867627f3dd 24 if(rcmd == 'h') {
HeptaSatTraining2019 26:39867627f3dd 25 sensor.gps_setting();
HeptaSatTraining2019 26:39867627f3dd 26 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];
HeptaSatTraining2019 26:39867627f3dd 27 float gx1,gy1,gz1;
HeptaSatTraining2019 26:39867627f3dd 28 for(int i = 0; i < 1000000; i++) {
HeptaSatTraining2019 26:39867627f3dd 29 sensor.sen_gyro_u16(gx,gy,gz);
HeptaSatTraining2019 26:39867627f3dd 30 sensor.sen_gyro(&gx1,&gy1,&gz1);
HeptaSatTraining2019 26:39867627f3dd 31 sensor.sen_acc_u16(ax,ay,az);
HeptaSatTraining2019 26:39867627f3dd 32 sensor.sen_mag_u16(mx,my,mz);
HeptaSatTraining2019 26:39867627f3dd 33 eps.vol_u16(bt);
HeptaSatTraining2019 26:39867627f3dd 34 sensor.temp_sense_u16(temper);
HeptaSatTraining2019 26:39867627f3dd 35 sensor.lat_log_sensing_u16(lad,log,height);
HeptaSatTraining2019 26:39867627f3dd 36 com.putc('H');
HeptaSatTraining2019 26:39867627f3dd 37 pc.printf("gx=%f,gx16=%c%c%c%c\r\n",gx1,gx[0],gx[1],gx[2],gx[3]);
HeptaSatTraining2019 26:39867627f3dd 38 com.xbee_transmit(gx,gy,gz,ax,ay,az,mx,my,mz,lad,log,height,bt,temper);
HeptaSatTraining2019 26:39867627f3dd 39
HeptaSatTraining2019 26:39867627f3dd 40 }
HeptaSatTraining2019 26:39867627f3dd 41 }
HeptaSatTraining2019 26:39867627f3dd 42 com.initialize();
HeptaSatTraining2019 26:39867627f3dd 43 }
HeptaSatTraining2019 26:39867627f3dd 44 }
umeume 2:1c5cdb2c3e0f 45 }