Vanesa Lara Cruz / Mbed 2 deprecated serial-protocol-V2

Dependencies:   mbed

Fork of 02_LAB_serial_protocol by ferney alberto beltran molina

Revision:
20:b7f2e428b24c
Parent:
18:08bd68471535
--- a/draw.cpp	Thu Oct 19 23:43:31 2017 +0000
+++ b/draw.cpp	Fri Oct 20 00:50:00 2017 +0000
@@ -3,6 +3,10 @@
 #include "mbed.h"
 #include "math.h"
 
+#if DEBUG_DRAW
+    Serial debugdraw(USBTX, USBRX);
+#endif
+ 
 DigitalOut led(LED1);
 
 PwmOut myServoX(PB_3);
@@ -64,7 +68,7 @@
     myServoX.pulsewidth_us(pulseX);
     myServoY.pulsewidth_us(pulseY);
    
-    wait_ms(ss_time); //TODO: CALCULAR EL TIEMPO DE DONDE  VIENE 
+    sstime(); 
 
 }
 
@@ -88,14 +92,17 @@
                 
     if (abs(m)<=1){    
         b=(float)yf-(float)(m*xf);
-  //      command.printf(" m =  %f b= %f \n", m,b);
+        #if DEBUG_DRAW
+            debugdraw.printf("debugdraw m =  %f b= %f \n", m,b);
+        #endif
         xp =xi;
         while(run)
         {
             yp =m*xp+b;
             vertex2d(xp ,yp);
-            //print_bin2hex(xp);  print_bin2hex(yp);  
-            //command.printf(" \n");
+            #if DEBUG_DRAW
+                debugdraw.printf(" debugdraw %f %f \n", xp,yp);
+            #endif
             if (xf>xi){ 
                 xp=xp+st;
                 if (xp>xf)run=0;
@@ -108,14 +115,17 @@
     }else{ 
         m=(float)(xf-xi)/(yf-yi);
         b=(float)xf-(float)(m*yf);
-  //      command.printf(" m =  %f b= %f \n", m,b);
+        #if DEBUG_DRAW
+            debugdraw.printf("debugdraw m =  %f b= %f \n", m,b);
+        #endif
         yp =yi;
         while(run)
         {
             xp =m*yp+b;
             vertex2d(xp ,yp);
-         //   print_bin2hex(xp);  print_bin2hex(yp);  
-         //  command.printf(" \n");
+         #if DEBUG_DRAW
+            debugdraw.printf("debugdraw %f %f \n", xp,yp);
+         #endif
             if (yf>yi){ 
                 yp=yp+st;
                 if (yp>yf)run=0;