Permalink
Browse files

interpret data

  • Loading branch information...
1 parent 4a97e07 commit 09e9413a03d3a853e7f90ad69a7a58126fb73a2a @svdgraaf committed Feb 28, 2012
Showing with 37 additions and 1 deletion.
  1. +37 −1 ps3/controller_debugger.py
View
@@ -15,13 +15,49 @@
# threshold for (analog) axis
threshold = 0.1
+# left
+axis0 = 0
+axis1 = 0
+left = None
+
+# right
+axis2 = 0
+axis3 = 0
+right = None
+
try:
while True:
for event in pygame.event.get():
if event.type == JOYAXISMOTION:
if abs(event.value) > threshold:
if event.axis == 0:
- print event
+ axis0 = event.value
+ if event.axis == 1:
+ axis1 = event.value
+ if event.axis == 2:
+ axis2 = event.value
+ if event.axis == 3:
+ axis3 = event.value
+
+ if axis1 < 0 and axis0 < 0:
+ # topleft
+ print "topleft"
+ elif axis1 > 0 and axis0 < 0:
+ # topright
+ print "bottomleft"
+ elif axis1 > 0 and axis0 > 0:
+ # bottomright
+ print "bottomright"
+ elif axis1 < 0 and axis0 > 0:
+ # bottomleft
+ print "topright"
+
+
+ # if axis2 < 0 and axis3 < 0:
+ # # topleft
+ # elif axis2 > 0 and axis3 < 0:
+ # # topright
+
if event.type == JOYBUTTONUP:
print event

0 comments on commit 09e9413

Please sign in to comment.