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

Dependencies:   FatFileSystem MSCFileSystem mbed

Fork of USBFlashDiskTest by Chris Styles

main.cpp

Committer:
chris
Date:
2012-10-16
Revision:
2:c887cf1c3ed9
Parent:
0:22a5db2c7926

File content as of revision 2:c887cf1c3ed9:

#include "mbed.h"
#include "MSCFileSystem.h"

MSCFileSystem fs("fs");
DigitalOut led(LED1);
AnalogIn pot1(p19);

int main()
{
    FILE *fp = fopen("/fs/test.csv","w");
    printf("Create filehandle for test.csv\n");

    printf("Writing to file\n");
    for (int i=0; i<100; i++)  {
        fprintf(fp,"%.2f\n",pot1.read());
        wait(0.05);
        led=!led;
    }

    fclose(fp);
    printf("Close the handle\n");
    led=1;
}