Skip to content

Instantly share code, notes, and snippets.

@dustynrobots
Created August 23, 2012 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dustynrobots/3439903 to your computer and use it in GitHub Desktop.
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
#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