Skip to content

Instantly share code, notes, and snippets.

@olizilla
Created January 7, 2014 21:01
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 olizilla/8306846 to your computer and use it in GitHub Desktop.
Save olizilla/8306846 to your computer and use it in GitHub Desktop.
#include <Servo.h>
Servo servo;
int servoPin = 9;
int rotationSpeed = 1250;
// Oi! Jamie! You may need to noodle the value of `rotationSpeed`
// As far as I can tell, it means:
// rotationSpeed = 1000; // means full speed FWD
// rotationSpeed = 1500; // means stop
// rotationSpeed = 2000; // means full speed REV
// You can pick any value inbetween 1000 and 1500 to alter the speed
// at which it spins FWD, or between 1500 and 2000 for speed in REV.
void setup() {
servo.attach(servoPin);
servo.write(1500); // let's send a stop command to reset things first
}
void loop() {
servo.write(rotationSpeed); // tell the servo to move at `rotationSpeed`
delay(15); // pause for 15ms before telling it again.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment