Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "USBMouse.h" 00003 00004 DigitalOut led(LED1); 00005 USBMouse mouse; 00006 00007 int main() { 00008 Serial pc(USBTX, USBRX); // tx, rx 00009 pc.printf("Hello serial comms!\n"); 00010 00011 //the "my mouse isn't working" spaz out 00012 mouse.buttons(1,0,0); 00013 mouse.buttons(0,0,0); 00014 int x =1; 00015 while(x<=10){ 00016 led = !led; 00017 mouse.buttons(1,0,0); 00018 //move right 00019 mouse.move(10, 0); 00020 mouse.buttons(0,0,0); 00021 mouse.move(-9, 0); 00022 mouse.move(0,5); 00023 x++; 00024 } 00025 00026 wait(0.8); //more than 0.5, less than 0.8 00027 00028 x =1; 00029 while(x<=10){ 00030 led = !led; 00031 mouse.buttons(0,1,0); 00032 //move right 00033 mouse.move(10, 0); 00034 mouse.buttons(0,0,0); 00035 mouse.move(-9, 0); 00036 mouse.move(0,10); 00037 x++; 00038 } 00039 00040 pc.printf("mouse should have drawn 10 lines of mouse2 color, proably 3 of mouse1 color\n"); 00041 00042 } 00043 /* 00044 move around in a square shaped spiral 00045 x=1; 00046 while(x<100){ 00047 led = !led; 00048 //wait(0.01); 00049 //move right 00050 mouse.move(10*x, 0); 00051 //move down 00052 mouse.move(0, 10*x); 00053 //increase count 00054 x=x+1; 00055 //move left 00056 mouse.move(-10*x, 0); 00057 //move up 00058 mouse.move(0, -10*x); 00059 //increase count again 00060 x=x+1; 00061 } 00062 */
Generated on Sat Jul 23 2022 12:44:01 by
1.7.2