Created
December 28, 2013 13:27
-
-
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.
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> | |
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