Skip to content

Instantly share code, notes, and snippets.

@li2hub
Last active July 10, 2018 15:30
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 li2hub/d56f2fdb289539cbaef8d2eddbb5635d to your computer and use it in GitHub Desktop.
Save li2hub/d56f2fdb289539cbaef8d2eddbb5635d to your computer and use it in GitHub Desktop.
#include <Servo.h> // Include the Servo library
int servoPin = 3; // Declare the Servo pin
Servo Servo1; // Create a servo object
void setup() {
Servo1.attach(servoPin); // We need to attach the servo to the used pin number
}
void loop(){
Servo1.write(0); // Make servo go to 0 degrees
delay(1000);
Servo1.write(90); // Make servo go to 90 degrees
delay(1000);
Servo1.write(180); // Make servo go to 180 degrees
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment