Arduino Code for controlling multi turn sail winch servo

Hi, is there a library which allows me to control a multi turn sail winch servo by inputting the angle because most servo libraries are limited to 0 - 180 degrees. Is it possible to modify the SoftwareServo library for this purpose? If not, how should I go about writing the code because I only know the simple basics in programming. Thank you very much for your help.

Link for Arduino SoftwareServo Library
http://www.arduino.cc/playground/ComponentLib/servo

Link for multi turn sail winch servo

You need to work out the ratio between the 0-180 servo library position, and the actual position of the winch servo. I believe they use the same timings, but have a multi-turn pot. You could use also Servo.writeMicroseconds() (Servo - Arduino Reference), to give more precise control.

Well the datasheet says that it is a 4 turn servo. And as a servo it's position commands span 1000 usec to 2000 usec for full travel. So you are probably much better off using the servo library's writeMicroseconds commands rather then using the 0-180 degree commands. Then you can map the servos 0-1,440 degrees of travel to 1000 to 2000 usecs command values. Map is a very useful function to make such conversions simple.

http://arduino.cc/en/Reference/Map

Also I think you would be better off using the servo library that ships standard with the latest arduino IDE. Although I am not familiar with the one you linked to.

Good luck;

Lefty

Yes, you definitely want use the standard, timer-based, Servo library, rather than the Software Servo one. You have to keep periodically (every 50ms or less) refreshing the Software Servo instances, to keep the positions held.

Servo test code for dual position input. The deg input in the servo library is just internally mapping the degree value to a us value.

// zoomkat 10-22-11 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// for IDE 0022 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.

String readString;
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {
  Serial.begin(9600);
  myservo.writeMicroseconds(1500); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo control 
  Serial.println("servo-test-22-dual-input"); // so I can keep track of what is loaded
}

void loop() {
  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string 
    int n = readString.toInt();  //convert readString into a number

    // auto select appropriate value, copied from someone elses code.
    if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

    readString=""; //empty for next input
  } 
}