Luis Miguel Lovera Salazar / Mbed 2 deprecated 01-01Solucionfuncione

Dependencies:   mbed

Fork of 01-01Solucionfuncionservo by Luis Miguel Lovera Salazar

Revision:
5:ffac1facf6c7
Parent:
3:fe8e265eaf6e
Child:
6:9b41d99d6490
--- a/main.cpp	Wed Mar 07 00:10:11 2018 +0000
+++ b/main.cpp	Mon Sep 03 17:37:52 2018 +0000
@@ -1,5 +1,5 @@
 #include "mbed.h"
-#define MAXPOS 50       // en milimetros
+#define MAXPOS 180      // en milimetros
 #define SS_TIME 100     // en microsegundos
 #define POSDRAW 10      
 
@@ -11,7 +11,7 @@
 int coord2us(float coord)
 {
     if(0 <= coord <= MAXPOS)
-        return int(750+coord*1900/50);// u6
+        return int(750+coord*1900/180);// u6
     return 750;
 
 }
@@ -50,13 +50,18 @@
     {
         wait(2);
         vertex2d(posx,posy);
-        posx+=10;
-        if (posx>50){
+        posx+=90;
+        posy+=90;
+        if (posx>180){
             posx=0;
             nodraw();
         }
-        posy=posy;
-     }
+        if (posy>180){
+            posy=0;
+            nodraw();
+        }
+        
+   }
 
 }