by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"

Dependencies:   mbed

main.cpp

Committer:
robt
Date:
2013-06-16
Revision:
0:e339343b3624

File content as of revision 0:e339343b3624:

/* 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);
    }
  }
}