Created
November 11, 2021 13:14
-
-
Save woodif/23501fc156f60192455d2303148fc9e9 to your computer and use it in GitHub Desktop.
This file contains 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> | |
static const int servoPin = 14; //14,15 | |
Servo servo1; | |
void setup() { | |
Serial.begin(115200); | |
servo1.attach(servoPin); | |
} | |
void loop() { | |
for(int posDegrees = 0; posDegrees <= 180; posDegrees++) { | |
servo1.write(posDegrees); | |
Serial.println(posDegrees); | |
delay(20); | |
} | |
for(int posDegrees = 180; posDegrees >= 0; posDegrees--) { | |
servo1.write(posDegrees); | |
Serial.println(posDegrees); | |
delay(20); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment