Intro: Adding a Joystick to the Raspberry Pi
Joysticks are really fun to use. They are also much more intuitive than other input devices. Adding a joystick to your Raspberry Pi opens a lot of new doors. You can now use the Raspberry Pi and the joystick to control a robot, a camera, play games or do whatever you want.
We'll be using the GrovePi and a Grove Joystick in this guide and show you how easy it is to integrate a joystick in your next Raspberry Pi Project
Step 1: Hardware Required
Step 2: Connect the Joystick to the Raspberry Pi
First mount the GrovePi shield on the Raspberry Pi. Then take the Grove Joystick and connect it to the port A0 of the GrovePi. Now power on the Raspberry Pi
Step 3: Setting Up the Software
Clone the Grove Pi repository to the Desktop on your Raspberry Pi.
git clone https://github.com/DexterInd/GrovePi.git
Once you have downloaded the repository, go to the /Software/Python folder in the GrovePi folder.
Step 4: Getting the Data From the Joystick
Just run the Python Program and you'll start getting the Joystick data back.
sudo python grove_thumb_joystick.py
Move the joystick and you'll see the data getting updated.
You can now use this Joystick to control your robot, RC airplane or whatever you want to control.