Servo control


I would like to controll a singel servo in four different angle positions, that are linked to four analog inputs (relay) The servo should stop on the desired angle when the analog input is activated.

Analog Input 1 > Servo 0 degrees Analog input 2 > Servo 45 degrees Analog input 3 > Servo 90 degrees Analog input 4 > Servo 180 degrees

Any one that can help out with the code for this task?

Many thanks!


Sounds like you need a series of if statements.

If you want more than that you'll have to clarify your requirements. Analog inputs read analog signals. They aren't "activated or not activated". That logic implies digital inputs.