Hello everyone. I'm newbie here.
I planned to make a robotic arm controlled by a webserver. Almost all the codes are working perfectly except for the gripper. I made a code for the gripper and I don't think it match to what I really wanted. I wanted to control the gripper's servo through html button and make it move slowly by pressing the button once and make it stop by pressing it again and the same concept with the reverse of it. I need also to set its limit for the servo inorder to prevent it by destroying itself if ever forgotten to make it stop. By the way, I used a 180 servo.
If someone could help me. Any suggestion will be helpful. Thank you
By the way here is the code I made based on the code for its main arm. I'll be able to state it's lower and upper limit but I couldn't make it move slowly by pressing the button once and make it stop by pressing it again and vice versa...
if (readString.indexOf("?buttonhold") >0){ //tell the arm to go down
{
(pos=pos+30); //change value for larger increments
if(pos>90) (pos=90); //limit lower value
servogriptwist.write(pos); // tell servo to go to position in variable 'pos'
}
}
if (readString.indexOf("?buttonrelease") >0){ //tell the arm to go up
{
(pos=pos-30); //change value for larger increments
if(pos<0) (pos=0); //limit upper value
servogriptwist.write(pos); // tell servo to go to position in variable 'pos'
}
}