rev_20211121
Dependencies: HEPTA_SENSOR mbed HEPTA_EPS HEPTA_COM HEPTA_CDH
Diff: main.cpp
- Revision:
- 25:ccc5ff675e0c
- Parent:
- 24:3659e0c223c8
- Child:
- 26:220e5f95168a
diff -r 3659e0c223c8 -r ccc5ff675e0c main.cpp --- a/main.cpp Wed Aug 21 18:02:15 2019 +0000 +++ b/main.cpp Wed Aug 21 18:32:04 2019 +0000 @@ -1,53 +1,32 @@ #include "mbed.h" -#include"HEPTA_EPS.h" -#include"HEPTA_CDH.h" -#include"HEPTA_SENSOR.h" -#include"HEPTA_COM.h" - -#include "mbed.h" +#include "HEPTA_CDH.h" +#include "HEPTA_EPS.h" Serial pc(USBTX,USBRX); -DigitalOut myleds[] = {LED1,LED2,LED3,LED4};; -int rcmd = 0,cmdflag = 0; - -void commandget() -{ - rcmd=pc.getc(); - cmdflag = 1; -} -void receive(int *xrcmd, int *xcmdflag) -{ - pc.attach(commandget,Serial::RxIrq); - *xrcmd = rcmd; - *xcmdflag = cmdflag; -} - -void initialize() -{ - rcmd = 0; - cmdflag = 0; -} int main() { pc.baud(9600); - receive(&rcmd,&cmdflag); - while(1) { - myleds[0] = 1; - wait(0.5); - myleds[0] = 0; - wait(0.5); - if (cmdflag == 1) { - if (rcmd == 'a') { - //Please enter your answer in this part - - - - // - } - initialize(); - } + float bt; + char str[100]; + mkdir("/sd/mydir", 0777); + FILE *fp = fopen("/sd/mydir/test.txt","w"); + if(fp == NULL) { + error("Could not open file for write\r\n"); } + for(int i = 0; i < 10; i++) { + + + + } + fclose(fp); + fp = fopen("/sd/mydir/test.txt","r"); + for(int j = 0; j < 10; j++) { + + + } + fclose(fp); + pc.printf("Goodbye!!\r\n"); } \ No newline at end of file