USBmouse

Dependencies:   USBDevice mbed

Fork of USBMouse_HelloWorld by Samuel Mokrani

Revision:
5:36a45d09bb56
Parent:
3:b8caa902d79e
--- a/main.cpp	Fri Mar 01 13:26:13 2013 +0000
+++ b/main.cpp	Wed Feb 19 05:23:20 2014 +0000
@@ -1,20 +1,35 @@
 #include "mbed.h"
 #include "USBMouse.h"
+#include "DebouncedIn.h"
+
 
 USBMouse mouse;
+DigitalIn joy_left(p13);
+DigitalIn joy_right(p16);
+DigitalIn joy_up(p15);
+DigitalIn joy_down(p12);
 
 int main() {
-    int16_t x = 0;
-    int16_t y = 0;
-    int32_t radius = 10;
-    int32_t angle = 0;
+    int16_t x = 600;
+    int16_t y = 200;
+    //int32_t radius = 10;
+    //int32_t angle = 0;
 
     while (1) {
-        x = cos((double)angle*3.14/180.0)*radius;
-        y = sin((double)angle*3.14/180.0)*radius;
+        //x = cos((double)angle*3.14/180.0)*radius;
+        //y = sin((double)angle*3.14/180.0)*radius;
+        if (joy_left)
+           x = x-5;
+        if (joy_right)
+           x = x+5;
+        if (joy_up)
+           y = y+5;
+        if (joy_down)
+           y = y-5;
+            
         
         mouse.move(x, y);
-        angle += 3;
+        //angle += 3;
         wait(0.001);
     }
 }
\ No newline at end of file