Isme 5 x 5 ka grid plot hota h screen me, USBmouse use karke. As soon as you connect the board to PC via HID

Dependencies:   USBDevice mbed

Fork of USBMouse_HelloWorld by Samuel Mokrani

Files at this revision

API Documentation at this revision

Comitter:
akashlal
Date:
Wed Jul 06 12:51:27 2016 +0000
Parent:
4:26ecbbc27530
Commit message:
na

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Mar 01 13:26:13 2013 +0000
+++ b/main.cpp	Wed Jul 06 12:51:27 2016 +0000
@@ -1,20 +1,49 @@
 #include "mbed.h"
 #include "USBMouse.h"
-
 USBMouse mouse;
-
 int main() {
     int16_t x = 0;
     int16_t y = 0;
-    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;
-        
-        mouse.move(x, y);
-        angle += 3;
-        wait(0.001);
-    }
+    int point = 5;
+    int scale = 40;
+    int i;
+    int j=0;
+    
+        for(i=1;i<=point;i++)
+        {
+            if(j==0)
+            {
+                mouse.click(MOUSE_LEFT);
+                mouse.release(MOUSE_LEFT);
+                mouse.move(20,0);
+            }
+            for(j=1;j<=point;j++)
+            {   
+                mouse.click(MOUSE_LEFT);
+                mouse.release(MOUSE_LEFT);
+                x=scale;
+                y=0;
+                mouse.move(x, y);
+                wait(0.5);
+            }    
+            x = 0;
+            y = scale;
+            mouse.move(x, y);
+            x= -(scale);
+            y=0;
+            mouse.move(x, y);
+            x= -(scale);
+            y=0;
+            mouse.move(x, y);
+            x= -(scale);
+            y=0;
+            mouse.move(x, y);
+            x= -(scale);
+            y=0;
+            mouse.move(x, y);
+            x= -(scale);
+            y=0;
+            mouse.move(x, y);
+            j=1;
+        }
 }
\ No newline at end of file