Hello workers at Velleman, Or just people in the forums
I started working on the Allbot 408 when i noticed it sliding away.
I tried to make it slower but that didnt work, i did notice when you dont have any other movement in your allbot it stands still without sliding.
So when i try to get it to walk or anything else it will just slowly stop moving because it’s too heavy
I wanted to ask if anyone had the same problem and know how to solve it
I use this code:
#include <Servo.h>
#include <ALLBOT.h>
ALLBOT BOT(8); //number of motors
enum MotorName {
hipFrontLeft,
hipFrontRight,
hipRearLeft,
hipRearRight,
kneeFrontLeft,
kneeFrontRight,
kneeRearLeft,
kneeRearRight
};
int sounderPin = 13;
void setup() {
//INIT sounder
pinMode(sounderPin, OUTPUT);
// Chirp for begin
chirp(2, 25);
chirp(3, 200);
//NAME.attach(motorname, pin, init-angle, flipped, offset-angle);
BOT.attach(hipFrontLeft, A1, 45, 0, 0);
BOT.attach(hipFrontRight, A0, 45, 1, 0);
BOT.attach(hipRearLeft, 9, 45, 1, 0);
BOT.attach(hipRearRight, 4, 45, 0, 0);
BOT.attach(kneeFrontLeft, 11, 45, 0, 0);
BOT.attach(kneeFrontRight, 2, 45, 1, 0);
BOT.attach(kneeRearLeft, 10, 45, 1, 0);
BOT.attach(kneeRearRight, 3, 45, 0, 0);
//wait for joints to be initialized
delay(500);
// Chirp for ready
chirp(1, 50);
chirp(1, 255);
chirp(3, 0);
}
void loop() {
// put your main code here, to run repeatedly:
walk(400);
delay(200);
}
void walk(int speedms){
BOT.move(hipRearRight, 0);
BOT.move(kneeRearRight, 130);
BOT.move(hipFrontLeft, 0);
BOT.move(kneeFrontLeft, 130);
BOT.animate(speedms);
delay(1000);
BOT.move(kneeRearRight, 45);
BOT.move(kneeFrontLeft, 45);
BOT.animate(speedms);
delay(2000);
BOT.move(hipRearRight, 45);
BOT.move(hipFrontLeft, 45);
BOT.animate(speedms);
delay(200);
BOT.move(hipFrontRight, 0);
BOT.move(kneeFrontRight, 130);
BOT.move(hipRearLeft, 0);
BOT.move(kneeRearLeft, 130);
BOT.animate(speedms);
delay(1000);
BOT.move(kneeFrontRight, 45);
BOT.move(kneeRearLeft, 45);
BOT.animate(speedms);
delay(2000);
BOT.move(hipFrontRight, 45);
BOT.move(hipRearLeft, 45);
BOT.animate(speedms);
}
void chirp(int beeps, int speedms){
for (int i = 0; i < beeps; i++){
for (int i = 0; i < 255; i++){
digitalWrite(sounderPin, HIGH);
delayMicroseconds((355-i) + (speedms*2));
digitalWrite(sounderPin, LOW);
delayMicroseconds((355-i) + (speedms*2));
}
delay(30);
}
}
Thanks in advance