Zack Clobes
/
USBKeyboardMouse
USB Keyboard and mouse Example. Based on USBMouse
main.cpp@0:86603687efec, 2011-01-18 (annotated)
- Committer:
- zackc
- Date:
- Tue Jan 18 02:16:00 2011 +0000
- Revision:
- 0:86603687efec
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
zackc | 0:86603687efec | 1 | #include "mbed.h" |
zackc | 0:86603687efec | 2 | #include "USBMouse.h" |
zackc | 0:86603687efec | 3 | #include "USBKeyboard.h" |
zackc | 0:86603687efec | 4 | |
zackc | 0:86603687efec | 5 | DigitalOut led(LED1); |
zackc | 0:86603687efec | 6 | USBMouse mouse; |
zackc | 0:86603687efec | 7 | USBKeyboard keyboard; |
zackc | 0:86603687efec | 8 | |
zackc | 0:86603687efec | 9 | int main() { |
zackc | 0:86603687efec | 10 | while(1) { |
zackc | 0:86603687efec | 11 | mouse.move(18, 10); //moves the mouse down and to the left |
zackc | 0:86603687efec | 12 | keyboard.sendKeys("foo"); //sends the word "foo" through the keyboard |
zackc | 0:86603687efec | 13 | |
zackc | 0:86603687efec | 14 | led = !led; //cycles the LED on/off |
zackc | 0:86603687efec | 15 | wait(2); //waits 2 seconds, then repeats |
zackc | 0:86603687efec | 16 | } |
zackc | 0:86603687efec | 17 | } |