Lab5
Dependencies: HEPTA_SENSOR mbed HEPTA_EPS HEPTA_COM
Diff: main.cpp
- Revision:
- 26:1a95952b6fd1
- Parent:
- 25:5fd40a170032
--- a/main.cpp Tue Aug 27 01:15:05 2019 +0000 +++ b/main.cpp Tue Aug 27 02:40:52 2019 +0000 @@ -1,23 +1,44 @@ #include "mbed.h" #include "HEPTA_EPS.h" -#include "HEPTA_CDH.h" #include "HEPTA_SENSOR.h" #include "HEPTA_COM.h" Serial pc(USBTX,USBRX); -HEPTA_EPS eps(p16,p26); -HEPTA_CDH cdh(p5,p6,p7,p8,"sd"); -HEPTA_SENSOR sensor(p17, - p28,p27,0xD0,0x18, - p13,p14,p25,p24); -HEPTA_COM com(p9,p10); + + -DigitalOut myled(LED1); + + int main() { - myled = 1; - wait(0.5); - myled = 0; - wait(0.5); + int i = 0,rcmd=0,cmdflag=0; + + com.printf("Count Up!\r\n"); + while(1) { + com.printf("num = %d\r\n",i); + i++; + wait(1.0); + com.xbee_receive(&rcmd,&cmdflag); + pc.printf("rcmd=%d, cmdflag=%d\r\n",rcmd, cmdflag); + if (cmdflag == 1) { + if (rcmd == 'a') { + pc.printf("Command Get %d\r\n",rcmd); + com.printf("HEPTA Uplink OK\r\n"); + pc.printf("===================\r\n"); + pc.printf("Accel sensing Mode\r\n"); + pc.printf("===================\r\n"); + for(int ii = 0; ii < 10; ii++) { + sensor.sen_acc(&ax,&ay,&az); + eps.vol(&bt); + + + + + wait(0.5); + } + } + com.initialize(); + } + } } \ No newline at end of file