USB File System Lab

Note orientation of the USB Connector (the Gold contacts are facing the breadboard)

Observe the wiring of the USB connector to the target

Pin 1 = VCC = Pin VU on the target board

Pin 2 = D- = D- on the target board

Pin 3 = D+ = D+ on the target board

Pin 4 = GND = GND on the target board

Edit the Local File System Lab file to include the MSCFileSystem for USB function.

 

#include "mbed.h"
#include "MSCFileSystem.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
MSCFileSystem fs("fs"); // do this last to demonstrate loading to a USB Flash stick the 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;
}


1 comment

22 Oct 2011 . Edited: 22 Oct 2011

-

You need to log in to post a comment