Need Help with Arduino code for gesture controlled robotic arm?

Hello! I'm doing a project on gesture controlled robotic arm. I'm using MATLAB for gesture recognition, and have interfaced it with the arduino board.

When a gesture, say up, is recognised, a pin is made high. How do I go about programming the arduino to make the arm move up (i.e control the servo motor in one direction) as long as I show up, and make it move back down when I show the gesture for down (make the servo motor rotate in the opposite direction for as long as the gesture is shown)? 
I only know how to do this for analog inputs, not digital ones.

I'm sorry if this is a silly question, I'm new to Arduino. Thank you for your time!

Use the arduino servo library and take a look at the examples.

AnjanaRao (author)  steveastrouk3 years ago
I need to make it stop when I stop showing the gesture, and start moving from where it stopped when I show the gesture again. How do I do this?

Read the library, someone who can write sufficient MatLab to do the recognition task can understand using the servo library.

You need two pins, because up stopped and down is three states not two.

If pin "Up" is set, increase position signal to the arm.

If pin "Down" is set, decrease position signal to thearm.

If neither up or down is asserted leave position signal alone.