Permalink
Browse files

added translation for coordinates into degrees

  • Loading branch information...
1 parent 09e9413 commit 6484b576b038470a373a1640369e4bb27c2483ff @svdgraaf committed Feb 28, 2012
Showing with 11 additions and 12 deletions.
  1. +11 −12 ps3/controller_debugger.py
View
@@ -9,6 +9,10 @@
j = pygame.joystick.Joystick(0)
j.init()
+# s = serial.Serial('/dev/tty.SLAB_USBtoUART')
+# s = serial.Serial('/dev/tty.usbmodemfa141')
+# s = serial.Serial('/dev/tty.usbmodemfd131')
+
print 'Initialized Joystick : %s' % j.get_name()
print 'axis: %s, buttons: %s' % (j.get_numaxes(), j.get_numbuttons())
@@ -41,22 +45,17 @@
if axis1 < 0 and axis0 < 0:
# topleft
- print "topleft"
+ left = 270 + int(90 * axis1 * -1)
elif axis1 > 0 and axis0 < 0:
- # topright
- print "bottomleft"
+ # bottomleft
+ left = 270 - int(90*axis1)
elif axis1 > 0 and axis0 > 0:
# bottomright
- print "bottomright"
+ left = int(90 * axis1) + 90
elif axis1 < 0 and axis0 > 0:
- # bottomleft
- print "topright"
-
-
- # if axis2 < 0 and axis3 < 0:
- # # topleft
- # elif axis2 > 0 and axis3 < 0:
- # # topright
+ # topright
+ left = int(90 * axis1) + 90
+ print left
if event.type == JOYBUTTONUP:

0 comments on commit 6484b57

Please sign in to comment.