Mateo Morales / Mbed 2 deprecated 00_LAB_COMMAND_SERVOfe

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
MateoMoralesV
Date:
Mon Feb 25 12:50:24 2019 +0000
Parent:
5:f6be64b76f98
Commit message:
m

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Feb 25 11:42:29 2019 +0000
+++ b/main.cpp	Mon Feb 25 12:50:24 2019 +0000
@@ -13,7 +13,11 @@
 
 
 Serial command(USBTX, USBRX);
-PwmOut myservo1(PB_4);
+PwmOut myservo1(PB_3);
+PwmOut myservo2(PB_4);
+PwmOut myservo3(PA_9);
+PwmOut myservo4(PB_10);
+
 /*INGRESE L A CONFIGURACION DE LOS MOTORES*/
 
 #define INITCMD 0xFF
@@ -75,17 +79,16 @@
    tip: deben pasar  grados a microsegundo */
 //fghgfhfgdhfdghfghg
 
-//      dpulse=degrees2usec(grados);
-//       myservo1.pulsewidth_us(dpulse);
+     dpulse=degrees2usec(grados);
+     myservo1.pulsewidth_us(dpulse);
 
 }
 
-
 uint32_t degrees2usec(uint8_t grados){
 // Retorno el valor en usegundos, donde
 //     y − y1 = m(x − x1 )
     if(grados <= DEGREES_MAX)
-        return int(750+grados*1900/180);// u6
-    return 750;
+        return int(500+grados*2400/180);// u6
+    return 500;
     
 }
\ No newline at end of file