I have built a simple hexapod.When I turn on my hexapod insted of running the code all the legs move and
get jammed.This happens no matter what code I run and the legs always get jammed in the same postion. The servos are being run by 4 aa batterys.The ground of the batteries and the arduino ground are conected .The arduino is conected to my computer.When the legs get jammed the servos are still running.On rare occasions it might work but then next time i upload to the board or unplug and then reconnect the arduino or unplug the power and plug it back in the problem persists. Any ideas on how to get it to stop getting jammed.
I have attached two pictures of the legs jammed and one of the legs in a normal postion.
Here is my code;
#include <Servo.h>
Servo servohead;
Servo servo1a; // Define our Servo
Servo servo1b;
Servo servo2a;
Servo servo2b;
Servo servo3a;
Servo servo3b;
Servo servo4a;
Servo servo4b;
Servo servo5a;
Servo servo5b;
Servo servo6a;
Servo servo6b;
void setup()
{
servo1a.attach(48); // servo on digital pin 26
servo2a.attach(42);
servo3a.attach(40);
servo4a.attach(36);
servo5a.attach(32);
servo6a.attach(28);
servo1b.attach(46);
servo2b.attach(44);
servo3b.attach(38);
servo4b.attach(34);
servo5b.attach(30);
servo6b.attach(26);
servohead.attach(24);
servo1a.write(90); //move 1a
delay(1000);
servo2a.write(90); //move 2a
delay(1000);
servo3a.write(90); //move 3a
delay(1000);
servo4a.write(90); //move 4a
delay(1000);
servo5a.write(90); //move 5a
delay(1000);
servo6a.write(90); //move 6a
delay(1000);
}
void loop()
{
servo2b.write(100); // lift feet
delay(150);
servo4b.write(30);
delay(150);
servo6b.write(30);
delay(150);
servo1a.write(90); // back legs
servo3a.write(90);
servo5a.write(90);
delay(150);
servo2a.write(120); // legs forward
servo4a.write(120);
servo6a.write(120);
delay(150);
servo2b.write(30); // feet down
delay(150);
servo4b.write(10);
delay(150);
servo6b.write(10);
delay(150);
servo1b.write(80); // feet up
delay(150);
servo3b.write(80);
delay(150);
servo5b.write(30);
delay(150);
servo2a.write(90); // legs back
servo4a.write(90);
servo6a.write(90);
delay(150);
servo1a.write(120); // legs forward
servo3a.write(120);
servo5a.write(120);
delay(150);
servo1b.write(30); // feet down
delay(150);
servo3b.write(30);
delay(150);
servo5b.write(10);
delay(150);
}


