Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FatFileSystem MSCFileSystem mbed
Fork of USBFlashDiskTest by
Revision 2:c887cf1c3ed9, committed 2012-10-16
- Comitter:
- chris
- Date:
- Tue Oct 16 15:47:35 2012 +0000
- Parent:
- 1:1f7a5d9bf5f7
- Commit message:
- Adapted from USBFlashDiskTest
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1f7a5d9bf5f7 -r c887cf1c3ed9 main.cpp
--- a/main.cpp Mon Jul 23 09:59:38 2012 +0000
+++ b/main.cpp Tue Oct 16 15:47:35 2012 +0000
@@ -1,39 +1,23 @@
-#include "mbed.h"
-#include "MSCFileSystem.h"
-
-MSCFileSystem sd("sd");
-
-
-DigitalOut led1(LED1);
-DigitalOut led2(LED2);
-DigitalOut led3(LED3);
-DigitalOut led4(LED4);
-
-int main() {
-
- printf("This is version 1.0 of the USB host test\n");
-
- FILE *fp = fopen("/sd/test.txt","w");
- printf("Create filehandle\n");
-
- led1= 1;
-
- if (fp == NULL) { //make sure it's been opened
- printf("its bad :-(\n");
- led2 = 1;
- exit(1);
- }
- printf("its good :-)\n");
-
- led3 = 1;
-
- fprintf(fp,"Hello world!\n");
- printf("Write to the file\n");
-
-
- fclose(fp);
- printf("Close the handle\n");
-
- led4 = 1;
- printf("\n");
-}
+#include "mbed.h"
+#include "MSCFileSystem.h"
+
+MSCFileSystem fs("fs");
+DigitalOut led(LED1);
+AnalogIn pot1(p19);
+
+int main()
+{
+ FILE *fp = fopen("/fs/test.csv","w");
+ printf("Create filehandle for test.csv\n");
+
+ printf("Writing to file\n");
+ for (int i=0; i<100; i++) {
+ fprintf(fp,"%.2f\n",pot1.read());
+ wait(0.05);
+ led=!led;
+ }
+
+ fclose(fp);
+ printf("Close the handle\n");
+ led=1;
+}
\ No newline at end of file
