by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Diff: main.cpp
- Revision:
- 0:e339343b3624
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Jun 16 15:30:33 2013 +0000 @@ -0,0 +1,18 @@ +/* Program Example 12.5: Emulating a USB mouse + */ +#include "mbed.h" // include mbed library +#include "USBMouse.h" // include USB Mouse library +USBMouse mouse; // define USBMouse interface + +int dx[]={40,0,-40,0}; // relative x position co-ordinates +int dy[]={0,40,0,-40}; // relative y position co-ordinates + +int main() { + while (1) { + for (int i=0; i<4; i++) { // scroll through position co-ordinates + mouse.move(dx[i],dy[i]); // move mouse to co-ordinate + wait(0.2); + } + } +} +