Created
January 7, 2014 21:01
-
-
Save olizilla/8306846 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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