for textbook v4.4
Dependencies: HEPTA_SENSOR mbed HEPTA_EPS HEPTA_COM HEPTA_CDH
main.cpp@25:ccc5ff675e0c, 2019-08-21 (annotated)
- Committer:
- HeptaSatTraining2019
- Date:
- Wed Aug 21 18:32:04 2019 +0000
- Revision:
- 25:ccc5ff675e0c
- Parent:
- 24:3659e0c223c8
- Child:
- 26:220e5f95168a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:bdbd3d6fc5d5 | 1 | #include "mbed.h" |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 2 | #include "HEPTA_CDH.h" |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 3 | #include "HEPTA_EPS.h" |
HeptaSatTraining2019 | 24:3659e0c223c8 | 4 | |
umeume | 2:1c5cdb2c3e0f | 5 | Serial pc(USBTX,USBRX); |
HeptaSatTraining2019 | 24:3659e0c223c8 | 6 | |
HeptaSatTraining2019 | 24:3659e0c223c8 | 7 | |
HeptaSatTraining2019 | 24:3659e0c223c8 | 8 | |
umeume | 2:1c5cdb2c3e0f | 9 | int main() |
umeume | 2:1c5cdb2c3e0f | 10 | { |
HeptaSatTraining2019 | 24:3659e0c223c8 | 11 | pc.baud(9600); |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 12 | float bt; |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 13 | char str[100]; |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 14 | mkdir("/sd/mydir", 0777); |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 15 | FILE *fp = fopen("/sd/mydir/test.txt","w"); |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 16 | if(fp == NULL) { |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 17 | error("Could not open file for write\r\n"); |
HeptaSatTraining2019 | 24:3659e0c223c8 | 18 | } |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 19 | for(int i = 0; i < 10; i++) { |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 20 | |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 21 | |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 22 | |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 23 | } |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 24 | fclose(fp); |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 25 | fp = fopen("/sd/mydir/test.txt","r"); |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 26 | for(int j = 0; j < 10; j++) { |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 27 | |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 28 | |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 29 | } |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 30 | fclose(fp); |
HeptaSatTraining2019 | 25:ccc5ff675e0c | 31 | pc.printf("Goodbye!!\r\n"); |
umeume | 2:1c5cdb2c3e0f | 32 | } |