software servo strange positions

I am using the software servo library for the first time in order to free up the usual timer for the virtual wire library

however, my servos seem to be going to the wrong position alternating between two points very close to one another

is there a problem with the code i am using ?

i would appreciate any help :smiley:

#include <SoftwareServo.h> 

SoftwareServo myservo;  // create servo object to control a servo 


void setup() 
{ 
  myservo.attach(3);  // attaches the servo on pin 2 to the servo object 
} 

void loop() 
{ 
 
  myservo.write(0);   
 SoftwareServo::refresh();  // sets the servo position according to the scaled value 
  delay(1000);                           // waits for the servo to get there 
 
myservo.write(180);       
 SoftwareServo::refresh();// sets the servo position according to the scaled value 
  delay(1000);                           // waits for the servo to get there 

}

Any reason for using SoftwareServo, and not just Servo?

Using the regular servo library produces this error in my code

Servo/Servo.cpp.o: In function __vector_11': /Applications/Arduino.app/Contents/Resources/Java/libraries/Servo/Servo.cpp:103: multiple definition of __vector_11'
VirtualWire/VirtualWire.cpp.o:/Applications/Arduino.app/Contents/Resources/Java/libraries/VirtualWire/VirtualWire.cpp:418: first defined here

from what i have read this means that the virtual wire library is already using the timer which the regular servo library relies upon.
The software servo library does not use this timer, or so i have read, and should work if i can get the code right

 SoftwareServo::refresh();  // sets the servo position according to the scaled value 
  delay(1000);                           // waits for the servo to get there

SoftwareServo can't keep sending signals to the servo during a delay() call. You WILL have to get rid of the delay.

Time to review the BlinkWithoutDelay example.