by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
main.cpp
00001 /* Program Example 12.5: Emulating a USB mouse 00002 */ 00003 #include "mbed.h" // include mbed library 00004 #include "USBMouse.h" // include USB Mouse library 00005 USBMouse mouse; // define USBMouse interface 00006 00007 int dx[]={40,0,-40,0}; // relative x position co-ordinates 00008 int dy[]={0,40,0,-40}; // relative y position co-ordinates 00009 00010 int main() { 00011 while (1) { 00012 for (int i=0; i<4; i++) { // scroll through position co-ordinates 00013 mouse.move(dx[i],dy[i]); // move mouse to co-ordinate 00014 wait(0.2); 00015 } 00016 } 00017 } 00018
Generated on Mon Jul 25 2022 22:15:39 by 1.7.2