Re: Assign Servo to button
There are a number of ways and it is really up to you how you want it to work. If you are mapping your servo control to buttons on a joystick, you could map a particular button to a constant servo value (say 220 is the position for it being open) and another press or another button sets the servo to another constant value (say 15 is the position for it being shut).
You could have open/close buttons that incrementally move the servo target as well.
Decide exactly how you want to control it with the joystick, read the documentation on the servos and joysticks, & then get creative.
If you have more specific questions, you'll need to post exactly what you're trying to do as well as your code.