Just a sample to show the USB serial communication can be done while the mbed volume mounted

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 //  Just a sample to show the USB serial communication can be done while the mbed volume mounted
00002 
00003 #include "mbed.h"
00004 
00005 LocalFileSystem local("local");
00006 
00007 int main() {
00008 
00009     FILE    *fp;
00010     printf( "TEST started\r\n" );
00011 
00012     if ( NULL == (fp    = fopen( "/local/test.txt", "w" )) )
00013         error( "couldn't open file to read...(2)" );
00014 
00015     for ( int i = 0; i < 10; i++ ) {
00016         printf( "%d\r\n", i );
00017         wait( 1 );
00018     }
00019 
00020     fprintf( fp, "hello file world\n" );
00021     fclose( fp );
00022 
00023     printf( "TEST completed\r\n" );
00024 }