
/*
  "Broom" Servo
  This example demonstrates the servo drive movement
  with a smooth stop in both directions
*/

#include <Servo.h>

Servo servo;       // create an Servo class instance to control the servo

int pos = 0;       // variable for storing servo position
int pin = 8;       // P1_9 for Start/Elsomik
void setup() {
  servo.attach(pin); // connecting the servo drive to specified digital pin
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // change degrees from 0 to 180 
    servo.write(pos);                   // command to servo drive - go to position of variable "pos"
    delay(15);                          // waiting for the servo to get there
  }
  for (pos = 180; pos >= 0; pos -= 1) { // change degrees from 180 to 0 
    servo.write(pos);                   // command to servo drive - go to position of variable "pos"
    delay(15);                          // waiting for the servo to get there
  }
}
