USB BARCODE READER

Dependencies:   USBHOST

Revision:
1:a12f904713ed
Parent:
0:0282e73ca55b
Child:
2:107b7b44bd35
--- a/main.cpp	Wed Feb 15 13:07:06 2017 +0000
+++ b/main.cpp	Fri Feb 17 12:04:00 2017 +0000
@@ -3,13 +3,13 @@
 DigitalOut led(LED1);
 void msd_task(void const *) {
     printf("init msd\n");
-    USBHostMSD msd("usb");
+    USBHostMSD *msd;
     int i = 0;
     printf("wait for usb memory stick insertion\n");
     while(1) {
-
+        msd = new USBHostMSD("usb");
         // try to connect a MSD device
-        while(!msd.connect()) {
+        while(!msd->connect()) {
             Thread::wait(500);
         }
 
@@ -29,9 +29,10 @@
         Thread::wait(500);
         printf("again\n");
         // if device disconnected, try to connect again
-        while (msd.connected()) {
+        while (msd->connected()) {
             Thread::wait(500);
         }
+        delete msd;
     }
 }