hepta

Dependencies:   HEPTA_COM HEPTA_EPS HEPTA_SENSOR mbed

Committer:
csmk18112
Date:
Tue Nov 08 07:37:10 2022 +0000
Revision:
31:b4362f35d2c8
Parent:
30:e0c9228b6594
d

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:bdbd3d6fc5d5 1 #include "mbed.h"
HeptaSatTraining2019 28:5af09d71985e 2 #include"HEPTA_EPS.h"
HeptaSatTraining2019 28:5af09d71985e 3 #include"HEPTA_SENSOR.h"
HeptaSatTraining2019 28:5af09d71985e 4 #include"HEPTA_COM.h"
umeume 2:1c5cdb2c3e0f 5
csmk18112 31:b4362f35d2c8 6 RawSerial pc(USBTX,USBRX,9600);
HeptaSatTraining2019 28:5af09d71985e 7 HEPTA_EPS eps(p16,p26);
HeptaSatTraining2019 28:5af09d71985e 8 HEPTA_SENSOR sensor(p17,
RyusukeIwata 30:e0c9228b6594 9 p28,p27,0x19,0x69,0x13,
RyusukeIwata 30:e0c9228b6594 10 p13, p14,p25,p24);
HeptaSatTraining2019 28:5af09d71985e 11 HEPTA_COM com(p9,p10);
umeume 5:c5ccb1b07e8f 12
umeume 2:1c5cdb2c3e0f 13 int main()
umeume 2:1c5cdb2c3e0f 14 {
HeptaSatTraining2019 26:1a95952b6fd1 15 int i = 0,rcmd=0,cmdflag=0;
HeptaSatTraining2019 28:5af09d71985e 16 float bt,ax,ay,az;
HeptaSatTraining2019 26:1a95952b6fd1 17 com.printf("Count Up!\r\n");
HeptaSatTraining2019 26:1a95952b6fd1 18 while(1) {
HeptaSatTraining2019 26:1a95952b6fd1 19 com.printf("num = %d\r\n",i);
HeptaSatTraining2019 26:1a95952b6fd1 20 i++;
HeptaSatTraining2019 26:1a95952b6fd1 21 wait(1.0);
HeptaSatTraining2019 26:1a95952b6fd1 22 com.xbee_receive(&rcmd,&cmdflag);
HeptaSatTraining2019 26:1a95952b6fd1 23 pc.printf("rcmd=%d, cmdflag=%d\r\n",rcmd, cmdflag);
HeptaSatTraining2019 26:1a95952b6fd1 24 if (cmdflag == 1) {
HeptaSatTraining2019 26:1a95952b6fd1 25 if (rcmd == 'a') {
HeptaSatTraining2019 26:1a95952b6fd1 26 pc.printf("Command Get %d\r\n",rcmd);
HeptaSatTraining2019 26:1a95952b6fd1 27 com.printf("HEPTA Uplink OK\r\n");
HeptaSatTraining2019 26:1a95952b6fd1 28 pc.printf("===================\r\n");
HeptaSatTraining2019 26:1a95952b6fd1 29 pc.printf("Accel sensing Mode\r\n");
HeptaSatTraining2019 26:1a95952b6fd1 30 pc.printf("===================\r\n");
HeptaSatTraining2019 26:1a95952b6fd1 31 for(int ii = 0; ii < 10; ii++) {
HeptaSatTraining2019 26:1a95952b6fd1 32 sensor.sen_acc(&ax,&ay,&az);
HeptaSatTraining2019 26:1a95952b6fd1 33 eps.vol(&bt);
HeptaSatTraining2019 28:5af09d71985e 34 com.printf("AX = %f\r\n",ax);
HeptaSatTraining2019 28:5af09d71985e 35 com.printf("AY = %f\r\n",ay);
HeptaSatTraining2019 28:5af09d71985e 36 com.printf("AZ = %f\r\n",az);
HeptaSatTraining2019 28:5af09d71985e 37 com.printf("V = %f\r\n",bt);
HeptaSatTraining2019 26:1a95952b6fd1 38 wait(0.5);
HeptaSatTraining2019 26:1a95952b6fd1 39 }
HeptaSatTraining2019 26:1a95952b6fd1 40 }
HeptaSatTraining2019 26:1a95952b6fd1 41 com.initialize();
HeptaSatTraining2019 26:1a95952b6fd1 42 }
HeptaSatTraining2019 26:1a95952b6fd1 43 }
umeume 2:1c5cdb2c3e0f 44 }