Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GPIO pins to RaspPi
#1
I am currently trying to program a simple pong game using pygame and thus far I have used pygame.KEYUP and pygame.KEYDOWN to control the game. I have a joystick that connects to the raspberry pi with GPIO pins and I am not sure how to program the game to use the joystick instead of the keyup and keydown controls. I cannot for the life of me figure out the imput commands to get the gpio pins to work with the joystick. Any help would be greatly appreciated.
Reply
#2
(Oct-26-2021, 05:30 PM)mmagner2022 Wrote: I have a joystick that connects to the raspberry pi with GPIO pins
what does that mean?
the easiest way is to use a play station controller connected by usb and pygame joystick.
joystick info
post your coding attempt/ wiring diagram/ components used.
Reply
#3
(Oct-26-2021, 07:44 PM)joe_momma Wrote:
(Oct-26-2021, 05:30 PM)mmagner2022 Wrote: I have a joystick that connects to the raspberry pi with GPIO pins
what does that mean?
the easiest way is to use a play station controller connected by usb and pygame joystick.
joystick info
post your coding attempt/ wiring diagram/ components used.

So thats the problem, I understand the concept of the pygame.joystick page but the joystick that I am attaching doesn't use a usb connection, but rather connects with GPIO pins. Here is an amazon link of what the product is: https://www.amazon.com/HiLetgo-Controlle...C57&sr=8-2
Reply
#4
Are you running this program on a pi or just using the pi to attach the joystick?
Recommended Tutorials:
Reply
#5
Quote:joystick potentiometer with (X, Y) 2 axis analog output, (Z) 1 button digital output.
looks like it's an analog output so you'll need an A/D converter
check out this tutorial:
joystick
mmagner2022 likes this post
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020