Created
August 23, 2012 18:23
-
-
Save dustynrobots/3439903 to your computer and use it in GitHub Desktop.
This is code we'll use to test each motor in the servo arm to set the limits of each degree of freedom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Servo.h> // shortcut to code written by awesome people to make our lives easier | |
Servo myServo; // create servo object to control a servo | |
int pos; // variable to store the servo position | |
void setup() // happens once | |
{ | |
myServo.attach(5); // attaches the servo on pin indicated to the servo object | |
} | |
void loop() // happens forever | |
{ | |
pos = 50; // strike a pose position | |
myServo.write(pos); // tell servo to go to position in variable 'pos' | |
delay(15); // waits 15ms for the servo to reach the position | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment