I am wondering how do i connect the push button part to an arduino ? Is that an analog or digital input. If it's digital input, do i just stick it into the digital pin i assigned it to? Also, is it possible for me to write a code for a servo to go to a certain degree when i push a joystick button (and stay there) and use another joystick button to open it ? Would it just be easier to use a regular push button? Thanks in advance !
Connect a digital input pin to to +5V with a 10K resistor (or use pinMode(pin, INPUT_PULLUP)) and connect the switch between the pin and Ground.
Connect a digital input pin to to Ground with a 10K resistor and connect the switch between the pin and +5V.
If you have access to both sides of the switch and neither side is connected to anything you have free choice of the methods. If one side of the switch is already connected to +5 or Ground then you have to use the matching method unless you want to cut the existing connection.