 # Servo value conversion / proportion.. help!

Hi guys. I hope I am not in OFF topic.. I have a variable (value from 0 to 180); this variable set my servo position.

Value = 0 -----> Servo fully clockwise rotated Value = 180 -----> Servo fully anticlockwise rotated

Ok, all working fine for now :)

After that, I added a second servo. I put this servo in a mirror position than the first servo (I hope you understand my poor english :( ) then I obtained mirror values: Value = 0 -----> Servo fully anticlockwise rotated Value = 180 -----> Servo fully clockwise rotated

and this is WRONG! I need to use same values and same positions for both my servos!:

Ok, so now I need something converting my second servo value.. I was thinking something like this:

IF value = 0 -----conversion-----> new_value = 180 IF value = 90 -----conversion-----> new_value = 90 IF value = 180 -----conversion-----> new_value = 0

So if the value will be, for example, 132??? how can I convert to the new_value???? IF value = 132 -----conversion-----> new_value = ????

I trying with proportions but I don't know, I can't! :disappointed_relieved:

Please can you provide me an arduino code to make this conversion? or just some tricks to obtain mirrored values for my second servo? Thank you!

P

``````rightServoPosition = 180 - leftServoPosition;
``````

Hackscribble:

``````rightServoPosition = 180 - leftServoPosition;
``````

Then:
new_value = 180 - value

Damn… was pretty easy Thank you so mutch Hackscribble!