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: USBHost_custom_Addiso
Fork of USBHostC270_example_GR-PEACH by
Diff: main.cpp
- Revision:
- 0:0d68fe822228
- Child:
- 1:473f339c54c1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Mar 06 17:06:56 2013 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "USBHostMSD.h"
+
+DigitalOut led(LED1);
+
+void msd_task(void const *) {
+
+ USBHostMSD msd("usb");
+ int i = 0;
+
+ while(1) {
+
+ // try to connect a USB flash disk
+ while(!msd.connect())
+ Thread::wait(500);
+
+ FILE * fp = fopen("/usb/test.txt", "a");
+
+ if (fp != NULL) {
+ fprintf(fp, "Hello fun SD Card World: %d!\r\n", i++);
+ printf("Goodbye World!\r\n");
+ fclose(fp);
+ } else {
+ printf("FILE == NULL\r\n");
+ }
+
+ // wait until the msd disk is disconnected
+ while(msd.connected())
+ Thread::wait(500);
+ }
+}
+
+
+int main() {
+ Thread msdTask(msd_task, NULL, osPriorityNormal, (1024+512) * 4);
+ while(1) {
+ led=!led;
+ Thread::wait(500);
+ }
+}
\ No newline at end of file
