Control 2 servos, 1 pot

hello,

complete beginner here, so im asking the 'no such thing as a dumb question' question.

I would like to control 2 servos (which would be turning ball valves, controlling water flow) .
I would like 1 potentiometer which controls both in a "mixing" way.

for example:

pot is at 0
sevo1 =0 %(off) and servo2 = 100% (on)

pot is 1/4 turn
servo1 = 25% and servo2 = 75%

pot is 3/4 turn
servo1 = 75% and servo 2 =25%

pot is full on
servo1 = 100% and servo 2 = 0% (off)

is this possible?
i have got the examples of 2 servos and 2 pots (one each) working, but have NO CLUE how to get any further.

i fundamentally don't have any code to share, as I have been following examples to date, and would be planning to power the servos external (connecting the ground pin to arduino)

pls help!

Hello sui001

Welcome to the worldbest Arduino forum ever.

Try this:

 myservo0.write(angle); 
 myservo1.write(180-angle);

Have a nice day and enjoy coding in C++.

3 Likes

Yes.
You have a number from reading the pot, so use that number to control servo 1 and 1024 - that number to control pot 2.
Use the map function on both numbers to convert them into the appropriate range for your servos.

So follow the example for 1 pot controlling 1 servo and generate a new number like I said for the second.

Yes that would be fine.

facepalm
that easy.
thank you!

I moved your topic to an appropriate forum category @sui001.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Physically mount each servo on opposite sides and use the code for one to both.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.