Lab5-02_uplink_downlink_lite
Dependencies: mbed HEPTA_CDH_lite HEPTA_COM_lite HEPTA_SENSOR_lite HEPTA_EPS_lite
main.cpp@3:1392e060f3a2, 2021-08-24 (annotated)
- Committer:
- heptasat2021
- Date:
- Tue Aug 24 02:52:11 2021 +0000
- Revision:
- 3:1392e060f3a2
- Parent:
- 2:7a7448b44db4
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 | 3:1392e060f3a2 | 16 | eps.turn_on_regulator();//turn on 3.3V conveter |
heptasat2021 | 3:1392e060f3a2 | 17 | sensor.setup(); |
heptasat2021 | 2:7a7448b44db4 | 18 | for(int i=0;i<10;i++){ |
heptasat2021 | 2:7a7448b44db4 | 19 | com.xbee_receive(&rcmd,&cmdflag); |
heptasat2021 | 2:7a7448b44db4 | 20 | com.printf("num=%d\r\n",i); |
heptasat2021 | 2:7a7448b44db4 | 21 | if(cmdflag==1){ |
heptasat2021 | 2:7a7448b44db4 | 22 | if(rcmd=='a'){ |
heptasat2021 | 2:7a7448b44db4 | 23 | sat.printf("rcmd=%c,cmdflag=%d\r\n",rcmd,cmdflag); |
heptasat2021 | 2:7a7448b44db4 | 24 | com.printf("Hepta-Sat Lite Uplink Ok\r\n"); |
heptasat2021 | 2:7a7448b44db4 | 25 | for(int i=0;i<10;i++){ |
heptasat2021 | 2:7a7448b44db4 | 26 | sensor.sen_acc(&ax,&ay,&az); |
heptasat2021 | 2:7a7448b44db4 | 27 | com.printf("%f,%f,%f\r\n",ax,ay,az); |
heptasat2021 | 2:7a7448b44db4 | 28 | wait_ms(1000); |
heptasat2021 | 2:7a7448b44db4 | 29 | } |
heptasat2021 | 2:7a7448b44db4 | 30 | } |
heptasat2021 | 2:7a7448b44db4 | 31 | com.initialize(); |
heptasat2021 | 2:7a7448b44db4 | 32 | } |
heptasat2021 | 2:7a7448b44db4 | 33 | wait_ms(1000); |
heptasat2021 | 0:da0f6aca15b8 | 34 | } |
heptasat2021 | 0:da0f6aca15b8 | 35 | } |