Stopping a servo before it reaches final position?
You don't have to tell the servo "go from 0 to 100 degrees."  

You can step it by single degrees in a loop, and read the pressure sensor in the loop.

Like this:

Angle=0
 while (pressure&lt;threshold and Angle&lt;100)
     SetServoPostion(Angle)
     sleep(4) //wait 4 mSecondsfor servo to move
     pressure=ReadAnalogInput(pressuresensor)
     Angle=Angle+1
 end while 

Alternatively, you have a timer that calls the increment routine every 10mS or whatever, and have it check the pressure before making the next increment.

Along with not crushing what ever your servo is supposed to hold, this method also leaves you with a fairly good idea of exactly where the servo is - you don't need a second sensor for that, and you don't need to hack the servo to read its position potentiometer.



The given delay in the example will still close the gripper in 400mSeconds, so you still have the same responsiveness.