Lab5-02_uplink_downlink_lite
Dependencies: mbed HEPTA_CDH_lite HEPTA_COM_lite HEPTA_SENSOR_lite HEPTA_EPS_lite
main.cpp@2:7a7448b44db4, 2021-08-20 (annotated)
- Committer:
- heptasat2021
- Date:
- Fri Aug 20 13:43:06 2021 +0000
- Revision:
- 2:7a7448b44db4
- Parent:
- 1:ddac5ec89167
- Child:
- 3:1392e060f3a2
For Hepta-Sat Lite
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
heptasat2021 | 0:da0f6aca15b8 | 1 | #include "mbed.h" |
heptasat2021 | 2:7a7448b44db4 | 2 | #include "HEPTA_EPS.h" |
heptasat2021 | 1:ddac5ec89167 | 3 | #include "HEPTA_CDH.h" |
heptasat2021 | 2:7a7448b44db4 | 4 | #include "HEPTA_SENSOR.h" |
heptasat2021 | 2:7a7448b44db4 | 5 | #include "HEPTA_COM.h" |
heptasat2021 | 1:ddac5ec89167 | 6 | HEPTA_CDH cdh(PB_5, PB_4, PB_3, PA_8, "sd"); |
heptasat2021 | 2:7a7448b44db4 | 7 | HEPTA_EPS eps(PA_0,PA_4); |
heptasat2021 | 2:7a7448b44db4 | 8 | HEPTA_SENSOR sensor(PA_7,PB_7,PB_6,0xD0); |
heptasat2021 | 2:7a7448b44db4 | 9 | HEPTA_COM com(PA_9,PA_10,9600); |
heptasat2021 | 2:7a7448b44db4 | 10 | Serial sat(USBTX,USBRX,9600); |
heptasat2021 | 0:da0f6aca15b8 | 11 | int main() |
heptasat2021 | 0:da0f6aca15b8 | 12 | { |
heptasat2021 | 2:7a7448b44db4 | 13 | sat.printf("Xbee Uplink Downlink Mode\r\n"); |
heptasat2021 | 2:7a7448b44db4 | 14 | int rcmd=0,cmdflag=0; |
heptasat2021 | 2:7a7448b44db4 | 15 | float ax,ay,az; |
heptasat2021 | 2:7a7448b44db4 | 16 | for(int i=0;i<10;i++){ |
heptasat2021 | 2:7a7448b44db4 | 17 | com.xbee_receive(&rcmd,&cmdflag); |
heptasat2021 | 2:7a7448b44db4 | 18 | com.printf("num=%d\r\n",i); |
heptasat2021 | 2:7a7448b44db4 | 19 | if(cmdflag==1){ |
heptasat2021 | 2:7a7448b44db4 | 20 | if(rcmd=='a'){ |
heptasat2021 | 2:7a7448b44db4 | 21 | sat.printf("rcmd=%c,cmdflag=%d\r\n",rcmd,cmdflag); |
heptasat2021 | 2:7a7448b44db4 | 22 | com.printf("Hepta-Sat Lite Uplink Ok\r\n"); |
heptasat2021 | 2:7a7448b44db4 | 23 | for(int i=0;i<10;i++){ |
heptasat2021 | 2:7a7448b44db4 | 24 | sensor.sen_acc(&ax,&ay,&az); |
heptasat2021 | 2:7a7448b44db4 | 25 | com.printf("%f,%f,%f\r\n",ax,ay,az); |
heptasat2021 | 2:7a7448b44db4 | 26 | wait_ms(1000); |
heptasat2021 | 2:7a7448b44db4 | 27 | } |
heptasat2021 | 2:7a7448b44db4 | 28 | } |
heptasat2021 | 2:7a7448b44db4 | 29 | com.initialize(); |
heptasat2021 | 2:7a7448b44db4 | 30 | } |
heptasat2021 | 2:7a7448b44db4 | 31 | wait_ms(1000); |
heptasat2021 | 0:da0f6aca15b8 | 32 | } |
heptasat2021 | 0:da0f6aca15b8 | 33 | } |