force sensor control for servos

Thanks a lot John your a magician:)
i treid out the code and it worked a treat. i didn't use the "break" function because the loop would reset, and the claw will open and drop the object.
instead i used "detach" and it just switched the servo off when the claw had a grip on the object. now i can use other servos to move the wrist around to transport the object. and then just use "attach" to give back power to the claw and it will release the object.

Job done. Thanks a lot John, i wouldnt have got it without your help.
i added the code so anyone who wants to see how to use grip control can use it

#include <Servo.h>

const int servoPin = 8;
const int sensorPin = A0;

int position;
int val;

Servo myservo;

void setup(){
myservo.write(0); // Open claw.
position = 0;
myservo.attach(servoPin );
}

void loop(){
openClaw();
delay(2000);
closeClaw();
delay(2000);
}

void openClaw() {
myservo.attach(8);
myservo.write(0); // Go to open position
position = 0;
}

void closeClaw() {
for (; position < 180; position++) {
myservo.write(position);
delay(40);
if(analogRead(sensorPin) > 450)
myservo.detach();

}
}