USBHID Hello World

Dependencies:   mbed USBDevice

main.cpp

Committer:
samux
Date:
2011-11-02
Revision:
0:30b74cf0e645
Child:
1:0216a6726c1c

File content as of revision 0:30b74cf0e645:

#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];
    }
}