Skip to content

Instantly share code, notes, and snippets.

@woodif
Created November 11, 2021 13:14
Show Gist options
  • Save woodif/23501fc156f60192455d2303148fc9e9 to your computer and use it in GitHub Desktop.
Save woodif/23501fc156f60192455d2303148fc9e9 to your computer and use it in GitHub Desktop.
#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