How to determine the maximum number of a joystick?
-
- One Eyed Hopeful
- Posts: 4
- Joined: Tue Feb 04, 2020 1:10 am
How to determine the maximum number of a joystick?
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?
-
- One Eyed Hopeful
- Posts: 4
- Joined: Tue Feb 04, 2020 1:10 am
Re: How to determine the maximum number of a joystick?
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)