Joystick Push button

Hello,

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 !

There are two ways to connect a switch:

1) 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.

2) 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.

do i just stick it into the digital pin i assigned it to

Basically yes. Connect from input pin to ground and enable the internal pull up resistors.

s 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)

Yes if you code it right.

Alright. That was fairly helpful ! i'll try it out and see if i dont blow anything.