top of page

Write to Servo Position Code
#include <Servo.h> //This line calls the Servo library which allows us to make specific command
Servo myservo; //Each servo in the code must be set up as its own object, this Servo object is named myservo
​void setup() {
myservo.attach(9); //Attach myservo to digital pin 9
}
void loop() {
myservo.write(0); //Name the servo then .write followed by the position writing to 0-180 in the ()
delay(1000); //This delay gives time for the servo to write to the position
}
bottom of page