Assignment: Servo Motor: Actuation Assignment 2
Collaborators:
Description:
I made a tripod crawler out of dowels. It ended up pretty heavy and mostly made out of tape, but does crawl (slowly) in a forward-ish direction.
Materials:
Servo Motor
Arduino Board
Wooden Dowels
Quarters (ballast)
Piece of cardstock
Piece of rubber band
Tape, lots and lots of tape
Arduino Code:
// Modified Sweep
// I used the servo library
// by Ian McDowell
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
int potPin = 0;
int val;
void setup()
{
myservo.attach(7); // attaches the servo on pin 9 to the servo object
}
void loop()
{
val = analogRead(potPin); //read the pot pin
val = val/2;
myservo.write(0);
delay(1200-val);
myservo.write(180);
delay(1200-val);
}
Video: