Created
August 21, 2018 21:14
-
-
Save TakesTheBiscuit/a76c9a21afb53cc327745e4a7a30f2ff to your computer and use it in GitHub Desktop.
continuous rotation servo clock and anticlock
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
// TURN CLOCKWISE, WAIT A BIT, THEN GO ANTI CLOCK DEMO ONLY | |
#include <Servo.h> | |
#define TURN_TIME 1200 | |
Servo myservo; | |
void setup() { | |
myservo.attach(9); | |
// Initially the servo must be stopped | |
} | |
void loop() { | |
// Start turning clockwise | |
myservo.write(0); | |
delay(TURN_TIME); | |
delay(TURN_TIME); | |
// go back other way | |
myservo.write(180); | |
// Wait for 1200ms | |
delay(TURN_TIME); | |
delay(TURN_TIME); | |
// kills the pwm signal | |
myservo.detach(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment