Lecture 13 USB Example
Dependencies: FatFileSystem MSCFileSystem mbed
Fork of mbed-App-USBFlash by
Diff: main.cpp
- Revision:
- 0:22a5db2c7926
- Child:
- 2:c887cf1c3ed9
diff -r 000000000000 -r 22a5db2c7926 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jul 23 09:35:54 2012 +0000 @@ -0,0 +1,39 @@ +#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"); +}