elbear_arduino_bsp/libraries/Servo/examples/Jerks/Jerks.ino

26 lines
762 B
C++

/*
"Jerks"
This example demonstrates the servo drive movement
with a sharp stop in both directions
*/
#include <Servo.h>
Servo servo; // create an Servo class instance to control the servo
int pin = 8; // P1_9 for Start/Elsomik
void setup() {
servo.attach(pin); // connecting the servo drive to specified digital pin
}
void loop() {
servo.write(0); // command to the servo drive - go to the 0 degree position (clockwise movement)
delay(1000); // wait
servo.write(90); // stop movement
delay(1000); // wait
servo.write(180); // command to the servo drive - move to the 180 degree position (counterclockwise movement)
delay(1000); // wait
servo.write(90); // stop movement
delay(1000); // wait
}