Samuel Mokrani
/
USBHID_HelloWorld
USBHID Hello World
Diff: main.cpp
- Revision:
- 0:30b74cf0e645
- Child:
- 1:0216a6726c1c
--- /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]; + } +}