Description:
I worked with Kevin Lessard on this lab. We constructed a walker using two servo motors and just one Arduino. For the body we used a cell phone case and added legs (dowel rods), business cards as springs, and a battery as a counter weight. The dowel rods would lift the casing off the card and would allow the crawler to spring backwards.
Components:
Phone case
2 x dowel rods
Business cards
2 x servos
1 x arduino
1 x breadboard
Rubberbands
Laptop
Usb cord
Que tips
staples
1 x battery
Code:
#include <Servo.h>
Servo servoR; // create servo object to control a servo
Servo servoL; // a maximum of eight servo objects can be created
int posR1 = 180; // variable to store the servo position
int posL1 = 40;
int posR2;
int posL2;
int angle = 70;
int start = 0;
int pause = 500;
void setup()
{
servoR.attach(7); // attaches the servo on pin 9 to the servo object
servoL.attach(8);
Serial.begin(9600);
}
void loop()
{
start = Serial.read();
start = start - '0';
if(start == 1){
servoL.write(posL1);
servoR.write(posR1);
delay(pause);
posL2 = posL1 + angle;
posR2 = posR1 - angle;
servoL.write(posL2);
servoR.write(posR2);
delay(pause);
servoL.write(posL1);
servoR.write(posR1);
//delay(1000);
}
}
Video: https://drive.google.com/file/d/0B_zirL99HZRIMlNnaUdCYzVaODQ/edit?usp=sharing
- Login to post comments