Skip to content

Instantly share code, notes, and snippets.

@dannystaple
Created December 28, 2013 13:27
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 dannystaple/8159506 to your computer and use it in GitHub Desktop.
Save dannystaple/8159506 to your computer and use it in GitHub Desktop.
Testing/calibrating servo's with the Arduino - asks for a position and moves the servo there.
#include <Servo.h>
Servo myservo;
void setup() {
myservo.attach(3);
Serial.begin(9600);
myservo.write(90);
}
void loop() {
Serial.print("Enter position:");
while (Serial.available() == 0);// wait for serial
int pos = Serial.parseInt();
Serial.println(pos, 10);
myservo.write(pos);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment