Program to test USB Mass storage

Dependencies:   FatFileSystem mbed MSCFileSystem

main.cpp

Committer:
chris
Date:
2012-07-23
Revision:
0:22a5db2c7926

File content as of revision 0:22a5db2c7926:

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

MSCFileSystem sd("sd");


DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);

int main() {

    printf("This is version 1.0 of the USB host test\n");

    FILE *fp = fopen("/sd/test.txt","w");
    printf("Create filehandle\n");

    led1= 1;

    if (fp == NULL) {                 //make sure it's been opened
        printf("its bad :-(\n");
        led2 = 1;
        exit(1);
    }
    printf("its good :-)\n");

    led3 = 1;

    fprintf(fp,"Hello world!\n");
    printf("Write to the file\n");


    fclose(fp);
    printf("Close the handle\n");

    led4 = 1;
    printf("\n");
}