Proyecto Hexápodo

Dependencies:   Servo SoftPWM

Fork of PwmOut_HelloWorld by Francisco Núñez Cid

Files at this revision

API Documentation at this revision

Comitter:
Francisco_12
Date:
Wed Oct 24 17:34:01 2018 +0000
Parent:
15:91e78eb9cae9
Commit message:
Paso a hilos;

Changed in this revision

hexapod.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/hexapod.cpp	Tue Oct 23 15:01:24 2018 +0000
+++ b/hexapod.cpp	Wed Oct 24 17:34:01 2018 +0000
@@ -2,7 +2,7 @@
 
 Serial my_serial(TX, RX); //Puerto serie
 
-Thread thread;
+Thread thread[6];
 
 SoftPWM patas[num_patas][num_servos] = {{SoftPWM(coxa_1),SoftPWM(femur_1),SoftPWM(tibia_1)},
                                         {SoftPWM(coxa_2),SoftPWM(femur_2),SoftPWM(tibia_2)},
@@ -12,12 +12,20 @@
                                         {SoftPWM(coxa_6),SoftPWM(femur_6),SoftPWM(tibia_6)}};
 
 int mov_home[num_patas][num_servos] = { {120,90,90},
+                                        {85,90,90},
+                                        {60,90,90},
+                                        {60,90,90},
+                                        {95,90,90},
+                                        {130,90,90}};
+
+
+                                        /*{120,90,90},
                                         {90,90,90},
                                         {60,90,90},
                                         {60,90,90},
                                         {90,90,90},
-                                        {115,90,90}};
-
+                                        {115,90,90}};*/
+                                        
 int mov_avanza[num_patas][num_servos] = { {135,135,135},
                                           {105,135,135},
                                           {75,135,135},
@@ -39,12 +47,12 @@
      mueve_pata(3,'H');
      mueve_pata(4,'H');
      mueve_pata(5,'H');
-     //mueve_hexapodo(0); //TIPO HOME
      wait_ms(3000);
+     //thread[0].start(callback(mueve_pata, patas[0][0], 'A'));
      bool mov = false;
      while(1){
         if (mov == true) {
-            mueve_pata(0,'R');
+            /*mueve_pata(0,'R');
             mueve_pata(1,'A');
             mueve_pata(2,'R');
             mueve_pata(3,'A');
@@ -56,9 +64,8 @@
             mueve_pata(2,'A');
             mueve_pata(3,'R');
             mueve_pata(4,'A');
-            mueve_pata(5,'R');
+            mueve_pata(5,'R');*/
         }
-        //mueve_hexapodo(1);
          mov = !mov;
          wait_ms(2500);
          }