Cheap Beginner Quadruped Robot
by Builder200 in Circuits > Arduino
701 Views, 4 Favorites, 0 Comments
Cheap Beginner Quadruped Robot
very easy and simple for beginners
Parts
for this project your going to need
lego
servo 4x
arduino mega
alot of wires
ultrasonic sensor optional
breadboard optional
cardboard
Assembly
so first what your going to want to do is glue the servos at the bottom of the cardboard and then after that you going to want to glue the mini lego legs you made on the servo caps do this 4x after your done that glue your arduino mega on yop and then glue the breadboard and ultrasonic sensor in front of the arduino mega.
here are the wiring
red=5v black=gnd yellow=pin 2 pin 3 pin 4 pin 5
repeat 3 more times of red and black
The Code
#include
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;
Servo servo7;
Servo servo8;
Servo servo9;
Servo servo10;
Servo servo11;
Servo servo12;
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);
servo9.attach(10);
servo10.attach(11);
servo11.attach(12);
servo12.attach(13);
}
void loop() {
servo1.write(0);
servo2.write(80);
servo3.write(40);
servo4.write(170);
servo5.write(80);
servo6.write(150);
servo7.write(180);
servo8.write(100);
servo9.write(140);
servo10.write(10);
servo11.write(80);
servo12.write(40);
}
void stand()
{
servo1.write(0);
servo2.write(80);
servo3.write(40);
servo4.write(170);
servo5.write(80);
servo6.write(150);
servo7.write(180);
servo8.write(100);
servo9.write(140);
servo10.write(10);
servo11.write(80);
servo12.write(40);
}
void legoneup()
{
servo1.write(0);
servo2.write(0);
servo3.write(40);
servo4.write(170);
servo5.write(80);
servo6.write(150);
servo7.write(180);
servo8.write(100);
servo9.write(140);
servo10.write(10);
servo11.write(0);
servo12.write(40);
}
void legtwoup()
{
servo1.write(0);
servo2.write(0);
servo3.write(20);
servo4.write(170);
servo5.write(80);
servo6.write(160);
servo7.write(180);
servo8.write(100);
servo9.write(130);
servo10.write(10);
servo11.write(0);
servo12.write(60);
}
void legthreeup()
{
servo1.write(0);
servo2.write(90);
servo3.write(30);
servo4.write(170);
servo5.write(80);
servo6.write(160);
servo7.write(180);
servo8.write(100);
servo9.write(130);
servo10.write(10);
servo11.write(80);
servo12.write(50);
}
void legfourup()
{
servo1.write(0);
servo2.write(90);
servo3.write(30);
servo4.write(180);
servo5.write(160);
servo6.write(160);
servo7.write(180);
servo8.write(180);
servo9.write(130);
servo10.write(10);
servo11.write(80);
servo12.write(50);
}