The joystick port is a quick and dirty analog to digital converter that can be used for many more things than just joysticks and gamepads.
In this project I used the joystick port to input the value of two LDRs (Light Dependent Resistors) to be used to calculate the velocity of an object. Two flashlights (or other sources of light) are placed in front of the two LDRs. The computer records the time between the blockage of the first and second sensors. Using the equation v = d / t the computer calculates the average velocity of the object.
Visit Here for more.