[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Problems with reading joystick axis values
Hello!
I have been playing around with joysticks in pygame a little bit.
This is my most recent testing code:
<code>
/import pygame
import time
pygame.init()
pygame.joystick.init()
joystick=pygame.joystick.Joystick(0)
joystick.init()
print(joystick.get_name() +" found")
axis_old=2
while 1:
axis=joystick.get_axis(0)
if axis != axis_old:
print(axis)
axis_old=axis
time.sleep(1)/
</code>
It should print the name of the joystick, read the values of axis 0 (i have
tried all other axes too) and print it every second.
It prints out this:
Logitech Logitech Attack 3 found
SDL_JoystickGetAxis value:0:
0.0
SDL_JoystickGetAxis value:0:
SDL_JoystickGetAxis value:0:
SDL_JoystickGetAxis value:0:
SDL_JoystickGetAxis value:0:
so it finds the correct stick (I also tried it with another one, no
problem), but it always reads 0, no matter how I move the axes. It also
prints "SDL_JoystickGetAxis value:0:" every time it reads from the joystick,
but as far as i know that's a known bug and already fixed in the newest dev
releases. But why does it always read 0?
The joysticks I have tested this with are both in working condition. I'm
using Ubuntu 12.04.
Thanks for your help in advance!
Daniel
--
View this message in context: http://pygame-users.25799.n6.nabble.com/Problems-with-reading-joystick-axis-values-tp127.html
Sent from the pygame-users mailing list archive at Nabble.com.