Hertz Controle

Dependencies:   USBDevice USBHost mbed

Files at this revision

API Documentation at this revision

Comitter:
ABuche
Date:
Sun Apr 15 17:11:14 2018 +0000
Commit message:
Initial Commit

Changed in this revision

USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
USBHost.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Sun Apr 15 17:11:14 2018 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/USBDevice/#53949e6131f6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBHost.lib	Sun Apr 15 17:11:14 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/USBHost/#7c3b59bb364e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Apr 15 17:11:14 2018 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "USBHostSerial.h"
+
+DigitalOut led(LED1);
+Serial pc(USBTX, USBRX);
+
+void serial_task(void const*) {
+    USBHostSerial serial;
+    
+    while(1) {
+    
+        // try to connect a serial device
+        while(!serial.connect())
+            Thread::wait(500);
+        
+        // in a loop, print all characters received
+        // if the device is disconnected, we try to connect it again
+        while (1) {
+        
+            // if device disconnected, try to connect it again
+            if (!serial.connected())
+                break;
+
+            // print characters received
+            while (serial.available()) {
+                printf("%c", serial.getc());
+            }
+            
+            Thread::wait(50);
+        }
+    }
+}
+
+int main() {
+    Thread serialTask(serial_task, NULL, osPriorityNormal, 256 * 4);
+    while(1) {
+        led=!led;
+        Thread::wait(500);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Apr 15 17:11:14 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/994bdf8177cb
\ No newline at end of file