Local File System Lab

#include "mbed.h"

AnalogIn ain (p20);
DigitalOut myled(LED1);
LocalFileSystem fs ("fs"); // do this first as a local file system to the board to store Analogue results

int main() {

    FILE *fp = fopen("/fs/data.csv","w");

    for (int i = 0; i < 100 ; i++) {
        fprintf(fp,"%.2f\n",ain.read());
        wait (0.1);
    }

    fclose(fp);
    myled=1;
}


0 comments

You need to log in to post a comment