Cheap Beginner Quadruped Robot
by Builder200 in Circuits > Arduino
424 Views, 4 Favorites, 0 Comments
Cheap Beginner Quadruped Robot
have you ever wanted to build your own robot well today i am here to tell you how to
Supplies
servos 4x
Arduino mega Uno
cardboard
jumper wires
Lego
hot glue
Parts
hello this is my first inscrutable there will be not many pictures but i can talk you through it ok so the first step your gonna need.
Arduino mega Uno
4x servos
jumper wires
cardboard
Lego
ultrasonic sensor if you want it will still work without one
hot glue
Assembly
first you cut out a square piece of cardboard once your done that glue the servos at the bottom then glue your Lego legs to the servo cap once don that wire it the wiring goes like this red=5v black=GND yellow=pin 2
do the same for black and red 3 other times for yellow attach the 3 remaining wires to pins 3 4 and 5
The Code
const int pingPin = 12; //trig pin of arduino
int inPin = 11; //echo pin of arduino.
//range in cm which is considered safe to enter, anything
//coming within less than 5 cm triggers red LED
int safeZone = 95;
int tonepin=10;
int redPin= A7;
int purplePin = A5;
int bluePin = A3;
// defines pins numbers
// defines variables
#include
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;
Servo servo7;
Servo servo8;
void setup() {
Serial.begin(9600);
pinMode(redPin, OUTPUT);
pinMode(purplePin, OUTPUT);
pinMode(bluePin, OUTPUT);
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() {
sit();
delay (1000);
stand ();
delay (1000);
walk ();
walk ();
walk ();
walk ();
walk ();
walk ();
walk ();
walk ();
delay (500);
}
void stand (){
servo1.write(90);
servo2.write(90);
servo3.write(90);
servo4.write(70);
}
void sit (){
servo1.write(0);
servo2.write(180);
servo3.write(180);
servo4.write(0);
}
void walk (){
delay (300);
servo1.write(90);
servo2.write(90);
servo3.write(140);
delay (300);
servo3.write(90);
servo4.write(70);
servo1.write(140);
servo2.write(50);
}
void left (){
delay (150);
servo1.write(150);
servo3.write(150);
servo2.write(150);
servo4.write(150);
delay (150);
servo1.write(130);
servo2.write(130);
servo4.write(130);
servo3.write(130);
}