Created
June 23, 2019 17:29
-
-
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.
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
// 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