so i just got my Arduino UNO and i am trying to programm a hand, that is going to close when you put something in it. So to do that i need to stick a pushbutton to the fingertips. I am useing a servo motor to move the finger. Here is my question:
How do i programm it, so when the button on the fingertip is pressed down the servo motor stops moving and it stays in its position when the button was pressed. For example: when the button was pressed while the servo was at 40 degree the servo should stay at 40 degree while the button is pressed down and go back to its original position when the button is not pressed down anymore.
I hope you understand what i am asking for and i would really appreciate it if you could help me with my problem. Thanks
How do i programm it, so when the button on the fingertip is pressed down the servo motor stops moving and it stays in its position when the button was pressed.
It's pitch dark. You can't see a thing. You need to go to the bathroom. How do YOU stop when you encounter a wall or other obstruction?
It's simple. Take a tiny step. If there is nothing in the way, take another. If there is, well, don't.
Stopping the servo is a simple matter of not telling it to go anymore. Unless you have a continuous-rotation-not-really-a-servo. If you do, you can't use it the way you want.
Start by making sure that you understand how to control a servo. Look at the Sweep example in the Servo library and get that working. It does what Paul suggests and moves the servo a little at a time. Get that working and you are well on your way to doing what you want.