Skip to content

Instantly share code, notes, and snippets.

@sfambach
Created June 23, 2019 17:29
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 sfambach/c575a793990d35bbc6bc5e2aba4cc0af to your computer and use it in GitHub Desktop.
Save sfambach/c575a793990d35bbc6bc5e2aba4cc0af to your computer and use it in GitHub Desktop.
Test of a linear servo, connecto to serial monitor and press enter (send empty string) to activate.
// Linearare Servo Test
// www.famnbach.net
// GPLv2
// -----------------------
#include <Servo.h>
#define SERVO_PIN 10
Servo myservo;
void setup() {
Serial.begin(9600);
pinMode(SERVO_PIN, OUTPUT);
digitalWrite(SERVO_PIN, false);
myservo.attach(SERVO_PIN);
myservo.write(20);
}
void loop() {
if (Serial.available()) {
Serial.readString();
myservo.write(140); // offen
delay(4100);
myservo.write(20); //Geschlossen
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment