USBHostMouse Hello World for ST-Nucleo-F446RE
Dependencies: F401RE-USBHost mbed
Fork of USBHostMouse_HelloWorld by
main.cpp
- Committer:
- va009039
- Date:
- 2016-05-01
- Revision:
- 7:26cbee9ef684
- Parent:
- 2:be0aafb2edc2
File content as of revision 7:26cbee9ef684:
#include "mbed.h" #include "USBHostMouse.h" DigitalOut led(LED1); void onMouseEvent(uint8_t buttons, int8_t x, int8_t y, int8_t z) { printf("buttons: %d, x: %d, y: %d, z: %d\r\n", buttons, x, y, z); } int main() { USBHostMouse mouse; // connect a USB mouse if (!mouse.connect()) { error("USB mouse not found.\n"); } // when connected, attach handler called on mouse event mouse.attachEvent(onMouseEvent); Timer t; t.reset(); t.start(); for(;;) { if (t.read_ms() > 500) { led = !led; t.reset(); } USBHost::poll(); } }