This is an extremely short script that takes input from a joystick and prints it to the console. Requires Pygame. This is a work in progress. Next up is printing the results inside a Panda window.
We're Sorry! We can't locate the page you requested.
Check the spelling on the Web address (capitalization and punctuation count). Otherwise, go to EarthLink.net, enter a search key word, or check out any of our services below.
Would you be so kind as to correct the link or post the code as text here? I am very interested ... Thx!
#Capturing input data from a joystick using Pygame
#Import pygame and init from pygame import * init()
#Setup and init joystick j=joystick.Joystick(0) j.init()
#Check init status if j.get_init() == 1: print "Joystick is initialized"
#Get and print joystick ID print "Joystick ID: ", j.get_id()
#Get and print joystick name print "Joystick Name: ", j.get_name()
#Get and print number of axes print "No. of axes: ", j.get_numaxes()
#Get and print number of trackballs print "No. of trackballs: ", j.get_numballs()
#Get and print number of buttons print "No. of buttons: ", j.get_numbuttons()
#Get and print number of hat controls print "No. of hat controls: ", j.get_numhats()
#Setup event information and print data from joystick while 1: for e in event.get(): if e.type != QUIT: print '%s: %s' % (event.event_name(e.type), e.dict)
I should mention - the latest version of panda, 1.3.0, sets the registry key that locates the python install directory. This, in turn, makes it easy to install python add-ons like pygame and the like.
Josh Yelon, Teacher, Carnegie Mellon Entertainment Technology Center