for textbook v4.4
Dependencies: HEPTA_SENSOR mbed HEPTA_EPS HEPTA_COM
main.cpp@26:1a95952b6fd1, 2019-08-27 (annotated)
- Committer:
- HeptaSatTraining2019
- Date:
- Tue Aug 27 02:40:52 2019 +0000
- Revision:
- 26:1a95952b6fd1
- Parent:
- 25:5fd40a170032
- Child:
- 28:5af09d71985e
Who changed what in which revision?
User | Revision | Line number | New 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_SENSOR.h" |
HeptaSatTraining2019 | 25:5fd40a170032 | 4 | #include "HEPTA_COM.h" |
umeume | 2:1c5cdb2c3e0f | 5 | |
umeume | 2:1c5cdb2c3e0f | 6 | Serial pc(USBTX,USBRX); |
HeptaSatTraining2019 | 26:1a95952b6fd1 | 7 | |
HeptaSatTraining2019 | 26:1a95952b6fd1 | 8 | |
umeume | 2:1c5cdb2c3e0f | 9 | |
HeptaSatTraining2019 | 26:1a95952b6fd1 | 10 | |
HeptaSatTraining2019 | 26:1a95952b6fd1 | 11 | |
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 | 26:1a95952b6fd1 | 16 | |
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 | 26:1a95952b6fd1 | 34 | |
HeptaSatTraining2019 | 26:1a95952b6fd1 | 35 | |
HeptaSatTraining2019 | 26:1a95952b6fd1 | 36 | |
HeptaSatTraining2019 | 26:1a95952b6fd1 | 37 | |
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 | } |