USBHID Hello World

Dependencies:   mbed USBDevice

Committer:
samux
Date:
Wed Nov 02 17:18:57 2011 +0000
Revision:
0:30b74cf0e645
Child:
1:0216a6726c1c

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samux 0:30b74cf0e645 1 #include "mbed.h"
samux 0:30b74cf0e645 2 #include "USBHID.h"
samux 0:30b74cf0e645 3
samux 0:30b74cf0e645 4 USBHID hid;
samux 0:30b74cf0e645 5 HID_REPORT recv;
samux 0:30b74cf0e645 6 BusOut leds(LED1,LED2,LED3,LED4);
samux 0:30b74cf0e645 7
samux 0:30b74cf0e645 8 /*
samux 0:30b74cf0e645 9 * In a loop, this program listens a HID_REPORT over USB.
samux 0:30b74cf0e645 10 * The first byte of this report represents the state of BusOut
samux 0:30b74cf0e645 11 * I use pywinusb to do that on windows (32bits).
samux 0:30b74cf0e645 12 */
samux 0:30b74cf0e645 13 int main(void) {
samux 0:30b74cf0e645 14 while (1) {
samux 0:30b74cf0e645 15 hid.read(&recv);
samux 0:30b74cf0e645 16 leds = recv.data[0];
samux 0:30b74cf0e645 17 }
samux 0:30b74cf0e645 18 }