Simple movement of hexapod in MBED

Good afternoon, I’m doing with the STM32 core-F401RE a 6-legged hexapod robot (3 servomotors in each leg) and I would like you to help me with the following:

Currently I control the 18 servomotors with a different pin of the board, but my problem is how to move several legs at once (each leg has 3 servos).

I would like to know if there is any example of simple movement to move a leg with 3 servos and several legs, to be able to test my hexapod.

Thank you very much !

Hi Jose,

Have you tried looking through the examples for the servomotor components listed here: https://os.mbed.com/components/cat/servomotor/ ?

Please let me know if you are looking for something different!

– Jenny, team Mbed

I am trying to test the example of the previous link in the “ServoProgram - main.cpp” program, but how can I put the servo to move in the PIN (PA_10) of my STM32 core - F401RE, because the calibrate is not available in PwmOut or in SoftPWM instead of putting Servo myServo (PA_10). Thank you.

I am referring to the following code in which I have the doubt:

#include "mbed.h"
#include "Servo.h"

Servo myservo(p21);
Serial pc(USBTX, USBRX);

int main() {

printf("Servo Calibration Controls:\n");
printf("1,2,3 - Position Servo (full left, middle, full right)\n");
printf("4,5 - Decrease or Increase range\n");

float range = 0.0005;
float position = 0.5;

while(1) {                   
    switch(pc.getc()) {
        case '1': position = 0.0; break;
        case '2': position = 0.5; break;
        case '3': position = 1.0; break;
        case '4': range += 0.0001; break; 
        case '5': range -= 0.0001; break; 
    }
    printf("position = %.1f, range = +/-%0.4f\n", position, range);
    myservo.calibrate(range, 45.0); 
    myservo = position;
}

}

I would like to try this example to move my servos but I have to connect the servo to a pin of my STM32 core F401RE, for example the PA_10 pin, but I would not know how, because I want to do it with the SoftPWM but it does not let me use the calibrate.