OttoDIY / OttoDIYLib

Latest and official Libraries for Arduino Otto DIY robots
http://www..ottodiy.com/
GNU General Public License v3.0
111 stars 73 forks source link

change speed #39

Closed BlackDiceagain closed 4 months ago

BlackDiceagain commented 4 months ago

Hello, changing the speed in movelegs are not possible :(

BlackDiceagain commented 4 months ago

`#include Otto Otto;

define greifer 8 // left leg pin, servo[0]

define gruen 9 // right leg pin, servo[1]

define orange 10 // left foot pin, servo[2]

define grau 11 // right foot pin, servo[3]

define Buzzer 13 //buzzer pin

void Otto_moveLegs(int T, int posLegL, int posLegR, int posFootL, int posFootR) { int posLegs[]={ posLegL,posLegR,posFootL,posFootR }; Otto._moveServos(T,posLegs); }

void setup() { Otto.init(greifer, gruen, orange, grau, true, Buzzer);

}

void loop() { Otto_moveLegs(3000,90,140,150,0); delay(500); }`

sfranzyshen commented 4 months ago

Hello, changing the speed in movelegs are not possible :(

Hi @BlackDiceagain the Otto_moveLegs() function is not part of the OttoDIYLib arduino library. If this function is not performing something you would like it to do make the necessary changes within your code.

void Otto_moveLegs(int T, int posLegL, int posLegR, int posFootL, int posFootR) {
    int posLegs[]={ posLegL,posLegR,posFootL,posFootR }; 
    Otto._moveServos(T,posLegs); 
}

Is your problem the fact that the _moveServos() function only allows for one time variable for all servo movements to be the same? If so, this feature is currently not available ... it is limited from the bottom up void _execute(int A[4], int O[4], int T, double phase_diff[4], float steps);

... perhaps you could find a way to complete what you want using either the _moveSingle() or direct calls to oscillateServos().

Good luck and if you do find a solution let us know.