Tag Archives: joystick

Gamepad Input in Python

Gamepad Input in Python   http://yameb.blogspot.com/2013/01/gamepad-input-in-python.html I want to be able to command my upcoming Quadrotor with a game controller, so I purchased a Gigaware PC Wired Controller for $17 from Radioshack: Quadrotors are usually controlled with two thumbsticks (4 axes): Left Thumbstick Up/Down: Throttle Left Thumbstick Left/Right: Yaw Right Thumbstick Up/Down: Pitch Left Thumbstick Left/Right: Roll This inexpensive controller seems perfect for what I need it for, and there are some buttons I can use for initialization and other things.

Python Joystick Test

  Instalasi & Testing Koneksi Joystick   import pygame as p p.init() stick = p.joystick.Joystick(0) stick.init() print(“initialized:”,bool(stick.get_init())) print(stick.get_name()) while stick.get_axis(0)*100 < 399: print(round(stick.get_axis(0)*100)) #need for right detection otherwise stick.get_axis always returns 0 for event in p.event.get(): None p.quit()