How to control a servo motor (Hobby) depending on a condition (input)

Hi

I am working on a project where I have to open and close a valve with a Servo motor (HS-322HD) depending on a value of an input. That means that depending of the input I want the servo to open the valve o close it until a certain point. The valve is a butterfly valve and it takes 10 turns to open or close completely. I want to be able to control the fluid of the valve depending on the input (That I get from a motor RPM, if the RPM are high I want to open the valve as quick a possible and in the other hand if the RPM are low I would want to close the valve).

Please if anyone can provide me with help. I am kind of new working with the arduino.

Thank you

This is the best way to implement a state machine:

http://arduino.cc/en/Reference/SwitchCase

Probably not a good application of a servo - multiple turns. A stepper would probably be better. A stepper would allow you to keep track of the valve position and would have more torque.