Skip to content

Instantly share code, notes, and snippets.

@thefzsalam
Created March 24, 2018 09:35
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 thefzsalam/4e64cb7b35fcb2c8d912ca904294a4c8 to your computer and use it in GitHub Desktop.
Save thefzsalam/4e64cb7b35fcb2c8d912ca904294a4c8 to your computer and use it in GitHub Desktop.
#include <Servo.h>
Servo servoMain; // Define our Servo
void setup()
{
servoMain.attach(10); // servo on digital pin 10
Serial.begin(9600)
}
void loop()
{
long deg = Serial.parseInt();
if(deg == 0) return;
Serial.print("Turning: ");
Serial.print(deg);
Serial.println(" degrees.");
servoMain.write(deg);
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment