Hello all, I am relatively new to robotics and I am having some trouble with a pet project, I am building a four legged walker however whenever I to upload the code to the micro controller to make it walk the robot contorts its limbs in a strange way. From there when I try to reset the servos back to the default position they remain that way until I unplug them from the micro controller, and reset them individually, i noticed the batteries (4 AA’s) get very hot during this as well. I have not been able to find a solution to this and hope y’all can shed some light on it. Any help is appreciated.
The micro controller (lynxmotion botboarduino)
Here is a link to a photo of what happens and of how the Controller is laid out.
drive.google.com/open?id=0ByEikbxW1YFYQmNkTEJCN1RtekE
UPDATE: it appears to only happen when five ore more servos are connected and attempting to operate.
Code for walking
#include <Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;
Servo servo7;
Servo servo8;
//int check = 0;
void setup() {
servo1.attach(2);
servo2.attach(3);
servo3.attach(4);
servo4.attach(5);
servo5.attach(6);
servo6.attach(7);
servo7.attach(8);
servo8.attach(9);
}
void loop() {
move_forward();
delay(30000);
stand();
delay(5000);
}
void stand () {
servo1.writeMicroseconds(1500);
servo2.writeMicroseconds(1500);
servo7.writeMicroseconds(1500);
servo8.writeMicroseconds(1500);
}
//Here is the move function
void move_forward(){
//first step setup
servo2.writeMicroseconds(1000);
servo8.writeMicroseconds(1000);
delay(1000);
servo1.writeMicroseconds(2000);
servo7.writeMicroseconds(1000);
delay(1000);
servo2.writeMicroseconds(1500);
servo8.writeMicroseconds(1500);
delay(1000);
//these servos move to center
servo1.writeMicroseconds(1500);
servo7.writeMicroseconds(1500);
//these move back
servo3.writeMicroseconds(2000);
servo5.writeMicroseconds(1000);
delay(1000);
//Here is the next step
servo4.writeMicroseconds(2000);
servo6.writeMicroseconds(2000);
delay(1000);
servo3.writeMicroseconds(1500);
servo5.writeMicroseconds(1500);
delay(1000);
servo4.writeMicroseconds(1500);
servo6.writeMicroseconds(1500);
delay(1000);
//reset begins
}
Code for reset
[code]
#include <Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;
Servo servo7;
Servo servo8;
void setup() {
servo1.attach(2);
servo2.attach(3);
servo3.attach(4);
servo4.attach(5);
servo5.attach(6);
servo6.attach(7);
servo7.attach(8);
servo8.attach(9);
}
void loop() {
servo1.writeMicroseconds(1500);
servo2.writeMicroseconds(1500);
servo3.writeMicroseconds(1500);
servo4.writeMicroseconds(1500);
servo5.writeMicroseconds(1500);
servo6.writeMicroseconds(1500);
servo7.writeMicroseconds(1500);
servo8.writeMicroseconds(1500);
delay(2000);
}
][/code]