An example program for mbed application board to show the USB flash disk working

Dependencies:   FatFileSystem MSCFileSystem mbed

Fork of USBFlashDiskTest by Chris Styles

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "MSCFileSystem.h"
00003 
00004 MSCFileSystem fs("fs");
00005 DigitalOut led(LED1);
00006 AnalogIn pot1(p19);
00007 
00008 int main()
00009 {
00010     FILE *fp = fopen("/fs/test.csv","w");
00011     printf("Create filehandle for test.csv\n");
00012 
00013     printf("Writing to file\n");
00014     for (int i=0; i<100; i++)  {
00015         fprintf(fp,"%.2f\n",pot1.read());
00016         wait(0.05);
00017         led=!led;
00018     }
00019 
00020     fclose(fp);
00021     printf("Close the handle\n");
00022     led=1;
00023 }