Hello all,
Is there a General Code for custom servos?
I am trying to retrofit the ISM from a W221 Sclass onto an older car.
So far i have the Module shifting through all the gears with the shifter.
Basically I need help with developing a custom servo control. I can read the position of the motor with a
pot attached to the shaft, but it needs to move to specific angles based on input from the shifter.
Here is my current code.
void setup() {
// put your setup code here, to run once:
pinMode(1, OUTPUT); // D Reverse
pinMode(2, OUTPUT);// d Turn Signal
pinMode(5, OUTPUT);// N
pinMode(3, OUTPUT); // left <--- r Brake Light
pinMode(0, OUTPUT);// right --> R Tail Light
}
void loop() {
// put your main code here, to run repeatedly:
int P1 = 0;
int P2 = 0;
int P3 = 0;
P1 = analogRead(3);
P2=analogRead(2);
P3=analogRead(1);
if(P2 >750 && P2 < 1024) { digitalWrite(0, HIGH) ;} // Reverse Module right ===>
else digitalWrite(0, LOW) ;
if (P3 >650 && P3 < 749) { digitalWrite(1, HIGH) ;} //reverse 1
else digitalWrite(1, LOW) ;
//if (P2 >500 && P2 < 749) { digitalWrite(1, HIGH) ;} //Neutral
//else digitalWrite(1, LOW) ;
if (P2 >250 && P2 < 499) { digitalWrite(2, HIGH) ;} //D Drive 1
else digitalWrite(2, LOW) ;
if(P2 >1 && P2 < 170) digitalWrite(3, HIGH) ; //D Drive Module <=== Left
else digitalWrite(3, LOW) ;
}
The shift selector acts as a pot as well, giving redundant signals through P1, P2, & P3.
The Module Works off of 12v, about 30A. I tried to implement a custom servo Sketch i fond on here with no luck ![]()
Any guidance is appreciated ![]()

