LocalFileSystemの書き込み速度

ArduinoのEEPROMへの書き込みに3.3msかかる、ということでしたので http://www.musashinodenpa.com/arduino/ref/index.php?f=1&pos=54 mbedはどうかと思い実験しました。

#include "mbed.h"

DigitalOut myled(LED1);
LocalFileSystem local("local"); 
DigitalOut statePin(p21);
Timer timer;

Serial pc(USBTX, USBRX);
int main() {
    int count;
    int begin, end;
    pc.baud(57600);
    timer.start();
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
        begin = timer.read_us();
        statePin = !statePin;
        FILE *fp = fopen("/local/log.txt", "a");
        fprintf(fp, "Hello:%d\n",count++);
        fclose(fp);
        statePin = !statePin;
        end = timer.read_us();
        pc.printf("%d us\n",end-begin);
    }
}

約70ms、驚きの遅さ。。。PCにマウントするとかそういう理由??

/media/uploads/takeshikodaira/localfilesystem.png


Please log in to post comments.