Example program of using USB mass storage device (USB flash disk) with STM32F407VET6 boards (compatible with Seed Arch Max). This is a fork of https://os.mbed.com/users/va009039/code/F401RE-USBHostMSD_HelloWorld/
Dependencies: mbed FATFileSystem USBHost-STM32F4
Diff: main.cpp
- Revision:
- 1:f1ba83d3df51
- Parent:
- 0:4ea663e6aa00
- Child:
- 2:c44e11315bd3
--- a/main.cpp Tue Feb 19 21:35:40 2019 +0000 +++ b/main.cpp Thu Nov 14 16:08:09 2019 +0000 @@ -1,7 +1,9 @@ #include "USBHostMSD.h" DigitalOut led1(LED1); - +char bkvar=73; +char bkvar1=74; +char bkvar2=75; int main() { printf("Starting..\r\n"); @@ -14,19 +16,52 @@ error("USB mass storage device not found.\n"); } - FILE* fp = fopen("/usb/test1.txt", "a"); + + FILE* fp = fopen("/usb/kvar.txt", "w"); + if (fp) { - fprintf(fp, "Hello from mbed.\n"); - for (int i = 0; i < 21; i++) { - fprintf(fp, " %d", i); + //fprintf(fp, "%i", bkvar); + //for (int i = 0; i < 30; i++) { + // bkvar=bkvar++; + + fprintf(fp, " %c", bkvar); led1 = !led1; - } + - fprintf(fp, "\n"); + //fprintf(fp, "\n"); fclose(fp); } + fp = fopen("/usb/kvar.txt", "w"); + + if (fp) { + //fprintf(fp, "%i", bkvar); + //for (int i = 0; i < 30; i++) { + // bkvar=bkvar++; + + fprintf(fp, " %c", bkvar1); + led1 = !led1; + - fp = fopen("/usb/test1.txt", "r"); + //fprintf(fp, "\n"); + fclose(fp); + } + fp = fopen("/usb/kvar.txt", "a"); + + if (fp) { + //fprintf(fp, "%i", bkvar); + //for (int i = 0; i < 30; i++) { + // bkvar=bkvar++; + + fprintf(fp, " %c", bkvar2); + led1 = !led1; + + + //fprintf(fp, "\n"); + fclose(fp); + } + + + fp = fopen("/usb/kvar.txt", "r"); if (fp) { int n = 0; while (1) {