Skip to content

Instantly share code, notes, and snippets.

@li2hub
Last active July 22, 2018 10:29
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/f5297e303f6d5b2ace3f6bf0c25d0fe0 to your computer and use it in GitHub Desktop.
Save li2hub/f5297e303f6d5b2ace3f6bf0c25d0fe0 to your computer and use it in GitHub Desktop.
#include <Servo.h> // Include the Servo library
int servoPin = 5; // 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