I am trying to get some life into my old logitech joystick. I have bought an D-Sub 15 pin female socket to connect to, so I didn't had to cut in the wires. I have found this site (http://pinouts.ru/Inputs/GameportPC_pinout.shtml), for the wiring, but I can't get the response, that I want. I am only trying to find out, what button is connected to what pin. My idea is to use the example code in Arduino called DigitalReadSerial, and to monitor when the numbers in serial monitor shifts from 0 to 1, But know matter what button, I press when I had set up my "circuit" I only get 0.
Anyone who has been anything like this before and has a good idea?
Apologize for the large picture, can't shrink it :~
The wiring is not clear from your photo. Please provide a schematic of how you have connected the joystick to the Arduino.
You will need to configure the button inputs with pullup resistors enabled, i.e. use pinMode(pin, INPUT_PULLUP), not pinMode(pin, INPUT).
I've never done anything with a joystick, so I'm just going by what I'm reading....
You don't need digitalSerialRead. The joystick is not serial. You might be confused by how the regular computer is reading the joystick. That's not too important because the Arduino can read both analog & digital signals.
Of course, you need to connect +5V and ground.
Let's start with the buttons - These are digital, so use a digital input pin and read the state of the pin with digitalRead(). It looks like the when you push the button, a connection is made to ground. That's fine, but you need something to change when you push the button. If you configure the input pin with pinMode, you can can enable the internal pull-up resistor. Now, when the switch/button is off/open the digital input will read 1 (high). When you press the button to ground the input, it will read 0 (low).
The actual joystick X & Y outputs connect to an analog input pin, and you read the position with analogRead(). Both should read somewhere around 512 (half way to 1023) with the joystick centered.
This article has some better images and discussion of interfacing to classic joysticks.