Description
This was a crawler that both Meena Vempaty and I built. It utilizes two servo motors, which rotate between 45 and 135 degrees through a loop in the Arduino code. One servo is flipped so that although they both rotate the same amount, one "leg" is moving forward while the other is moving backwards. The code is a modified version of the sample "Sweep" code, which can be found here: http://arduino.cc/en/Tutorial/Sweep
The crawaler uses its wooden "feet" (built with toothpicks, plywood, rubber bands, and glue) to move forward. The rubber bands were used to give the wood more grip. We also taped metal to the crawler, which acts as a counterweight so that it doesn't push itself up. They also look like eyes.
A video of our crawler in action can be found here: http://youtu.be/tbjOB_jImpE
Materials
2 - servo motors
1 - Arduino
duct tape
wires
glue
metal counterweights
plywood
toothpicks
Code
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
//rubber band side goes to pin 8
#include <Servo.h>
Servo myservo1; // create servo object to control a servo
Servo myservo2;
int pos = 0; // variable to store the servo position
void setup()
{
myservo1.attach(9); // attaches the servo on pin 9 to the servo object
myservo2.attach(8); // attaches the servo on pin 8 to the servo object
myservo1.write(pos); //initial setup for legs
myservo2.write(pos);
delay(15); // waits 15ms for the servo to reach the position
}
void loop()
{
for(pos = 45; pos < 135; pos += 1) // goes from 45 degrees to 135 degrees
{ // in steps of 1 degree
myservo1.write(pos); // tell servos to go to position in variable 'pos'
myservo2.write(pos);
delay(4); // waits 4ms for the servo to reach the position
}
for(pos = 135; pos>=40; pos-=1) // goes from 135 degrees to 45 degrees
{
myservo1.write(pos); // tell servos to go to position in variable 'pos'
myservo2.write(pos);
delay(4); // waits 4ms for the servo to reach the position
}
}
- Login to post comments