Lab5-03_create_satcode_step6_lite
Dependencies: mbed HEPTA_CDH_lite HEPTA_COM_lite HEPTA_SENSOR_lite HEPTA_EPS_lite
main.cpp@2:30f72f09756e, 2021-08-17 (annotated)
- Committer:
- heptasat2021
- Date:
- Tue Aug 17 11:01:44 2021 +0000
- Revision:
- 2:30f72f09756e
- Parent:
- 1:ddac5ec89167
- Child:
- 3:e5ae22e02335
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:30f72f09756e | 2 | #include "HEPTA_EPS.h" |
heptasat2021 | 1:ddac5ec89167 | 3 | #include "HEPTA_CDH.h" |
heptasat2021 | 2:30f72f09756e | 4 | #include "HEPTA_SENSOR.h" |
heptasat2021 | 2:30f72f09756e | 5 | #include "HEPTA_COM.h" |
heptasat2021 | 1:ddac5ec89167 | 6 | HEPTA_CDH cdh(PB_5, PB_4, PB_3, PA_8, "sd"); |
heptasat2021 | 2:30f72f09756e | 7 | HEPTA_EPS eps(PA_0,PA_4); |
heptasat2021 | 2:30f72f09756e | 8 | HEPTA_SENSOR sensor(PA_7,PB_7,PB_6,0xD0); |
heptasat2021 | 2:30f72f09756e | 9 | HEPTA_COM com(PA_9,PA_10,9600); |
heptasat2021 | 2:30f72f09756e | 10 | Serial sat(USBTX,USBRX,9600); |
heptasat2021 | 0:da0f6aca15b8 | 11 | int main() |
heptasat2021 | 0:da0f6aca15b8 | 12 | { |
heptasat2021 | 2:30f72f09756e | 13 | sat.printf("Xbee Uplink Downlink Mode\r\n"); |
heptasat2021 | 2:30f72f09756e | 14 | int rcmd=0,cmdflag=0; |
heptasat2021 | 2:30f72f09756e | 15 | float ax,ay,az; |
heptasat2021 | 2:30f72f09756e | 16 | for(int i=0;i<10;i++){ |
heptasat2021 | 2:30f72f09756e | 17 | com.xbee_receive(&rcmd,&cmdflag); |
heptasat2021 | 2:30f72f09756e | 18 | com.printf("num=%d\r\n",i); |
heptasat2021 | 2:30f72f09756e | 19 | if(cmdflag==1){ |
heptasat2021 | 2:30f72f09756e | 20 | if(rcmd=='a'){ |
heptasat2021 | 2:30f72f09756e | 21 | sat.printf("rcmd=%c,cmdflag=%d\r\n",rcmd,cmdflag); |
heptasat2021 | 2:30f72f09756e | 22 | com.printf("Hepta-Sat Lite Uplink Ok\r\n"); |
heptasat2021 | 2:30f72f09756e | 23 | for(int i=0;i<10;i++){ |
heptasat2021 | 2:30f72f09756e | 24 | sensor.sen_acc(&ax,&ay,&az); |
heptasat2021 | 2:30f72f09756e | 25 | com.printf("%f,%f,%f\r\n",ax,ay,az); |
heptasat2021 | 2:30f72f09756e | 26 | wait_ms(1000); |
heptasat2021 | 2:30f72f09756e | 27 | } |
heptasat2021 | 2:30f72f09756e | 28 | } |
heptasat2021 | 2:30f72f09756e | 29 | com.initialize(); |
heptasat2021 | 2:30f72f09756e | 30 | } |
heptasat2021 | 2:30f72f09756e | 31 | wait_ms(1000); |
heptasat2021 | 0:da0f6aca15b8 | 32 | } |
heptasat2021 | 0:da0f6aca15b8 | 33 | } |