forked from piborg/Gamepad
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListNames.py
More file actions
executable file
·40 lines (34 loc) · 981 Bytes
/
ListNames.py
File metadata and controls
executable file
·40 lines (34 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
# coding: utf-8
# Load the gamepad and time libraries
import Gamepad
import time
# Wait for a connection
if not Gamepad.available():
print('Please connect your gamepad...')
while not Gamepad.available():
time.sleep(1.0)
print('Gamepad connected')
# Pick the gamepad type
#gamepad = Gamepad.Gamepad() #Generic unnamed controls
#gamepad = Gamepad.PS3()
gamepad = Gamepad.PS4()
# Show the selected gamepad type
print('Gamepad type: ' + gamepad.__class__.__name__)
# Display axis names
axisNames = gamepad.availableAxisNames()
if axisNames:
print('Available axis names:')
for axis in axisNames:
print(' ' + str(axis))
else:
print('No axis name mappings configured')
print('')
# Display button names
buttonNames = gamepad.availableButtonNames()
if buttonNames:
print('Available button names:')
for button in buttonNames:
print(' ' + str(button))
else:
print('No button name mappings configured')