Joypad Polling
Posted: Mon May 18, 2015 12:47 pm
by alecgibson
I'm new to Pi development, but know some Python, so I'm helping a group of kids get started with their Pi using the provided library. I've had a look through the APIs, but there seems to be no mention of interaction with the Joypad / Directional Pad. Is anyone to advise on how the pad is accessed?
Re: Joypad Polling
Posted: Mon May 18, 2015 7:35 pm
by Davespice
The joystick just looks like a USB keyboard mapped to the cursor keys and Enter.
Try using it to navigate the Linux terminal history!
So all you need to do is look for those same keyboard events.
You should have an example file which demonstrates it.
Code: Select all
cd ~/astro-pi-hat/examples
./pygame_joystick.py
Code is also online here.
https://github.com/astro-pi/astro-pi-ha ... oystick.py