USBHID Hello World

Dependencies:   mbed USBDevice

Files at this revision

API Documentation at this revision

Comitter:
samux
Date:
Wed Nov 02 17:18:57 2011 +0000
Child:
1:0216a6726c1c
Commit message:

Changed in this revision

USBDevice.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Wed Nov 02 17:18:57 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/samux/code/USBDevice/#7f782bfe6962
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Nov 02 17:18:57 2011 +0000
@@ -0,0 +1,18 @@
+#include "mbed.h"
+#include "USBHID.h"
+
+USBHID hid;
+HID_REPORT recv;
+BusOut leds(LED1,LED2,LED3,LED4);
+
+/*
+ * In a loop, this program listens a HID_REPORT over USB.
+ * The first byte of this report represents the state of BusOut
+ * I use pywinusb to do that on windows (32bits).
+ */
+int main(void) {
+    while (1) {
+        hid.read(&recv);
+        leds = recv.data[0];
+    }
+}