Asked — Edited
Resolved Resolved by Rich!

Need Help With Key Command.

I want to be able to press a button lets say "Z" and once pressed and released I want a servo to go to a certain point and then return back to where it started. I know how to make it go there while I keep a button pressed and return once I release the button. But I need it to go there and then return with only a tap of the key. Does this make sense?.


ARC Pro

Upgrade to ARC Pro

Join the ARC Pro community and gain access to a wealth of resources and support, ensuring your robot's success.

United Kingdom
#1  

Yes that makes sense.

Basically, you need to run a script on key up and have nothing for the key down.

Then write your script to move the servo to position and back again, for instance


Servo(D0,100)
Sleep(1000)
Servo(D0,1)

There are other ways to move the servo and move it back again, check position before moving then move back to the position it was in... possibilities are endless really but if you need help with that script just say what it is doing and I'll give more help.

#2  

Thank you very much, that is exactly what I was needing. Cheers mate!.