Description:
In this project, a servo motor is used to move a paper cup forward by using a lever.
Video: https://dl.dropboxusercontent.com/u/1993925/CupCrawler.mov
Components used:
- (1) Arduino Uno
- (1) Servo motor
- (3) Cables
- (1) Paper Cup
Code used:
/*
* Paper cup crawler
* By Clemens Meyer
*
* A servo motor is used to move a paper cup forward by using a lever.
*/
#include <Servo.h> // Using Arduino's built-in servo library
Servo myservo
int servoPin = 7;
int wait = 1000;
int min_position = 30; // Set minimum position of servo in degrees (Hardware minimum: 0°)
int max_position = 114; // Set maximum position of servo in degrees (Hardware maximum: 174°)
void setup() {
myservo.attach(servoPin); // Attach servo to pin 7
}
void loop() {
myservo.write(min_position); // Move servo to minimum position
delay(wait); // Wait
myservo.write(max_position); // Move servo to maximum position
delay(wait); // Wait
}
- Login to post comments