USB memory
Dependencies: mbed FatFileSystemCpp
main.cpp
- Committer:
- MPPT51
- Date:
- 2020-03-11
- Revision:
- 4:85a07ebe0933
- Parent:
- 0:e294af8d0e07
File content as of revision 4:85a07ebe0933:
#include "mbed.h" #include "MSCFileSystem.h" MSCFileSystem msc("usb"); // Mount flash drive under the name "msc" Serial pc(USBTX, USBRX); //Timer timer; //書き込み時間を計測するタイマ int main() { // pc.printf("USB file open!\r\n"); FILE *fp = fopen( "/usb/test.csv", "w"); //ファイルを開く "W"は新規作成して書き込みっていう命令? pc.printf("USB fileopen0!\r\n"); if ( fp == NULL ) { pc.printf("USB fileopen!\r\n"); exit(1); } pc.printf("USB file write!\r\n"); // timer.start(); //書き込み時間測定開始 fprintf(fp,"Hello world! oookkk\n"); //ファイル書き込み // timer.stop(); //書き込み時間測定終了 fclose(fp); //ファイルを閉じる pc.printf("USB file close!\n"); // pc.printf("write time :%f\n\n\n",timer.read()); }