Problem controlling Hitec HS-7950TH servo with arduino

Hi,

i'm doing a project where i want to control a servo position sending OSC messages. I made it work fine with a small servo
( DGServo S05NF STD), but then I got bigger servo with a gearbox for my final set up
( http://www.servocity.com/html/spg7950a-bm-360_360o_rotation.html ) and it's not working anymore. I understand I probably have to calibrate different way my values because this servo is 360° and previous one was 180°, but rotations appears totally random to me...
Since i'm newbie, I went back to basic examples to see how the servo behave, like this basic sweep tutorial from adafruit:

#include <Servo.h> 
 
int servoPin = 9;
 
Servo servo;  
 
int angle = 0;   // servo position in degrees 
 
void setup() 
{ 
  servo.attach(servoPin); 
} 
 
 
void loop() 
{ 
  // scan from 0 to 180 degrees
  for(angle = 0; angle < 180; angle++)  
  {                                  
    servo.write(angle);               
    delay(15);                   
  } 
  // now scan back from 180 to 0 degrees
  for(angle = 180; angle > 0; angle--)    
  {                                
    servo.write(angle);           
    delay(15);       
  } 
}

With this code, the servo is supposed to move back and forth from 0 to 180, and the delay set the speed of the movment.
The new servo is moving back and forth as expected but is not taking consideration of the angle values. It moves at constant speed, more or less depending on the delay value:
For delay(40) it will move approximatively 270° back and forth
For delay(20) about 180° back and forth.

I also went back to a simple serial control code for the servo to check the behavior:

#include <Servo.h>
int servoPin = 9;
Servo servo;
int angle = 0;

void setup() {
  servo.attach(servoPin);
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() ) {
angle = Serial.read();
servo.write(angle);
    delay(15);
    
  }
}

The servo move when sending messages, most of times it changes direction in a logical way depending on the values, but i can't figure out any logical scale in the movement (and there is not for sure!). Sometimes it's also not moving at all, and when i'm reseting the board, the servo in supposed to go to 0 position and wait for signal, and it's just never taking the same position.

I'm using an ethernet arduino board, powered externally with 12V. The servo is powered through the arduino (but it's supposed to be able to work with 5V). I've been looking for troubleshooting using this servo with arduino, but it seems many people did projects with it successfully. Also, i've ordered 2 servos, and they both behave the same way...
I'm a bit out of clue, don't know where to look anymore, so if anybody has some ideas...

Thanks

I think there was another Thread recently that referred to those servos.

Looking at the link you posted I think that servo can be set for continuous rotation in which case the regular servo.write(angle) instructions actually define the speed rather than the position.

I also get the impression from your link that your servo could be changed to normal (non continuous rotation) use. You should contact the suppliers to get details of what you have and how to change it.

...R

Thanks for your answer @Robin2 !
Yes this servo can be set to 180, 360 or continuous rotation using a Hitec servo programmer...
I've already contact the supplier, we'll see if they say the same thing (which would mean they didn't set the servo correctly)

Thanks again!