[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Joystick



If anyone is interested in what i have so far it is not much but it works. Check it out.
Pair a PS3 controller on Mac, then run the script.

import subprocess
import pygame

pygame.init()
ps3 = pygame.joystick.Joystick(0)
ps3.init()

while True:
    try:
        pygame.event.pump()
        buttons = [ps3.get_button(0),ps3.get_button(1),ps3.get_button(2),ps3.get_button(3),ps3.get_button(4),ps3.get_button(5),ps3.get_button(6),ps3.get_button(7),ps3.get_button(8),ps3.get_button(9),ps3.get_button(10),ps3.get_button(11),ps3.get_button(12),ps3.get_button(13),ps3.get_button(14),ps3.get_button(15),ps3.get_button(16)]
        axis = [ps3.get_axis(0),ps3.get_axis(1),ps3.get_axis(2),ps3.get_axis(3)]
        print(buttons)
        print(axis)
        subprocess.call("clear")
    except KeyboardInterrupt:
        print("Exiting")
        raise

On Nov 22, 2012, at 8:20 PM, claudio canepa <ccanepacc@xxxxxxxxx> wrote:



On Fri, Nov 23, 2012 at 12:10 AM, Stephen Smitherman <srsmitherman@xxxxxxxxx> wrote:
Good Day,
Does anyone know what I can do to work on this project?
I have been able to successfully write a script to use the Playstation 3 controller via bluetooth on a Mac implementing pygame.Joystick. I am loosing many functions of the controller though because the joystick class is limited to typical joystick definitions. How can i get a copy of the joystick source to improve it to allow full six axis functionality.

Thanks

Stephen Smitherman

pygame source lives in a public mercurial repository:

Compilation instructions are over