How to determine the maximum number of a joystick?

Official forum for open source FreePIE discussion and development.
Post Reply
John Smith
One Eyed Hopeful
Posts: 4
Joined: Tue Feb 04, 2020 1:10 am

How to determine the maximum number of a joystick?

Post by John Smith »

Hello. There are several joysticks in the system. It is necessary to poll their status in a loop. To do this, we need to know the maximum number of the joystick. How to define it?
John Smith
One Eyed Hopeful
Posts: 4
Joined: Tue Feb 04, 2020 1:10 am

Re: How to determine the maximum number of a joystick?

Post by John Smith »

I answer my own question. This is the script I use at this time. I can't think of a better option yet. Useless forum.

Code: Select all

if starting:
    joyMax = 100

    for i in range(joyMax):
        try:
             joystick[i].setRange(-1000, 1000)
        except ValueError:
            joyMax = i - 1
            break


diagnostics.watch(joyMax)
Post Reply

Return to “FreePIE”