Servo Speed Control

Heureka! (As once an old greek said)
So it works now. Thanks for helping mem, Aniss1001 and AWOL.

I took the pot. that was originaly mounted inside the servo for positioning outside and ran a program that set the servo to a 90° angle. This way i could easily find the value where the servo stopped with the ex-servo-potentiometer ( half the resistance of the full pot. value ). So i set it to that value and sent the arduino servo.write() commands of 91°, 92°,... and so on. That way i found out that there are (at least concerning the servo i used) 13° around 90° where the servo´s speed is throttled.
I added a Potentiometer on an Analog input and divided its value to 30 steps. Two of these (in the middle position of the pot., two to make it a broader stop position) are used to stop the servo, by sending a 90° request. The other 14 steps on each sides send position signals to the servo which increase the servos speed when the pot.´s offset is increased, refering to the middle position. This way you can control speed and direction directly with one potentiometer.

This is my code:

// Controlling a Continuous Rotation Modded Servo´s Speed and Direction with a Potentiometer
// by non-existence 

#include <Servo.h> 
 
Servo myservo1;  

int potpin1 = 0;  // defines pin used for the potentiometer
int pot1val;    

void setup() 
{ 
  myservo1.attach(6);  // defines pin used for the servo 
}

void loop()
{
  pot1val = analogRead(potpin1);
  pot1val = map(pot1val, 0, 1023, 0, 29);

//Speed Steps for myservo1


  if(pot1val == 0)
 {
    myservo1.write(76);
 }
  else if(pot1val == 1)
 {
    myservo1.write(77);
 } 
  else if(pot1val == 2)
 {
    myservo1.write(78);
 }
  else if(pot1val == 3)
 {
    myservo1.write(79);
 }
  else if(pot1val == 4)
 {
    myservo1.write(80);
 }
  else if(pot1val == 5)
 {
    myservo1.write(81);
 }
 else if(pot1val == 6)
 {
    myservo1.write(82);
 }
  else if(pot1val == 7)
 {
    myservo1.write(83);
 }  
  else if(pot1val == 8)
 {
    myservo1.write(84);
 }  
  else if(pot1val == 9)
 {
    myservo1.write(85);
 }  
  else if(pot1val == 10)
 {
    myservo1.write(86);
 }  
  else if(pot1val == 11)
 {
    myservo1.write(87);
 }  
  else if(pot1val == 12)
 {
    myservo1.write(88);
 }  
  else if(pot1val == 13)
 {
    myservo1.write(89);
 }  
  else if(pot1val == 14)
 {
    myservo1.write(90);
 }
  else if(pot1val == 15)
 {
    myservo1.write(90);
 } 
  else if(pot1val == 16)
 {
    myservo1.write(91);
 }
  else if(pot1val == 17)
 {
    myservo1.write(92);
 }
  else if(pot1val == 18)
 {
    myservo1.write(93);
 }
  else if(pot1val == 19)
 {
    myservo1.write(94);
 }
 else if(pot1val == 20)
 {
    myservo1.write(95);
 }
  else if(pot1val == 21)
 {
    myservo1.write(96);
 }  
  else if(pot1val == 22)
 {
    myservo1.write(97);
 }  
  else if(pot1val == 23)
 {
    myservo1.write(98);
 }  
  else if(pot1val == 24)
 {
    myservo1.write(99);
 }  
  else if(pot1val == 25)
 {
    myservo1.write(100);
 }  
  else if(pot1val == 26)
 {
    myservo1.write(101);
 }  
  else if(pot1val == 27)
 {
    myservo1.write(102);
 }  
  else if(pot1val == 28)
 {
    myservo1.write(103);
 }
  else if(pot1val == 29)
 {
    myservo1.write(104);
 }
 
}

Its a bit stretched but so its better readable for human eyes :wink:

I'm planning to use this for a remote camera head on a camera crane.