Description:
I decided to use some parts of an erektor set to make this crawler. The crawler seems to be fast enough to give some real competition to other crawlers out in the wild!
Parts used:
Arduino Uno
1 servo motor
4 parts of the erektor set
Code used:
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(7); // attaches the servo on pin 7 to the servo object
}
void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(1); // waits 1ms for the servo to reach the position
}
delay(500); //wait for some time before going back
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(1); // waits 1ms for the servo to reach the position
}
delay(500); //wait for some time before going back
}
- Login to post comments