Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if starting:
- joystick[1].setRange(0,65535)
- joystick[0].setRange(-1000,1000)
- i = 0
- j = 0
- k = 0
- l = 0
- m = 0
- xoutput[0].Start = joystick[1].getDown(7)
- xoutput[0].Back = joystick[1].getDown(6)
- xoutput[0].Guide = joystick[1].getDown(12)
- xoutput[0].A = joystick[1].getDown(4)
- xoutput[0].B = joystick[1].getDown(8)
- xoutput[0].X = joystick[1].getDown(2)
- xoutput[0].Y = joystick[1].getDown(9)
- xoutput[0].L1 = joystick[1].getDown(0)
- xoutput[0].R1 = joystick[1].getDown(1)
- xoutput[0].L3 = joystick[1].getDown(5)
- xoutput[0].R3 = joystick[1].getDown(10)
- #pedals
- if joystick[1].y != 65535:
- xoutput[0].L2 = (65535 - joystick[1].y)*255/65535
- i = 1
- if joystick[1].zRotation != 65535:
- xoutput[0].R2 = (65535 - joystick[1].zRotation)*255/65535
- i = -1
- if joystick[0].y == 65535 and joystick[1].zRotation == 65535:
- xoutput[0].R2 == 0
- xoutput[0].L2 == 0
- i = 0
- #wheel
- if joystick[1].x != 32768:
- if joystick[1].x < 32768:
- xoutput[0].lx = ((joystick[1].x) ** 2)/32768 - 32768
- j = -1
- if joystick[1].x > 32768:
- xoutput[0].lx = -((joystick[1].x - 65535) ** 2)/32768 + 32768
- j = 1
- else:
- j = 0
- #remaining joystick axises used once only for calibration
- if joystick[0].y != 0:
- xoutput[0].ry = 32768*joystick[0].y/1000
- l = 1
- else:
- l = 0
- if joystick[0].x != 1:
- xoutput[0].rx = 32768*joystick[0].x/1000
- m = 1
- else:
- m = 0
- if joystick[0].yRotation != -4:
- xoutput[0].ly = 32768*joystick[0].yRotation/1000
- k = 1
- else:
- xoutput[0].ly = 0
- k = 0
- #useful for testing but not neccessary
- diagnostics.watch(joystick[1].x)
- diagnostics.watch(joystick[1].y)
- diagnostics.watch(joystick[1].zRotation)
- diagnostics.watch(joystick[0].x)
- diagnostics.watch(joystick[0].y)
- diagnostics.watch(joystick[0].yRotation)
- diagnostics.watch(xoutput[0].lx)
- diagnostics.watch(xoutput[0].ly)
- diagnostics.watch(xoutput[0].ry)
- diagnostics.watch(xoutput[0].rx)
- diagnostics.watch(xoutput[0].L2)
- diagnostics.watch(xoutput[0].R2)
- diagnostics.watch(i)
- diagnostics.watch(j)
- diagnostics.watch(k)
- diagnostics.watch(l)
- diagnostics.watch(m)
Add Comment
Please, Sign In to add comment