Skip to content

Instantly share code, notes, and snippets.

@danricho
Last active June 20, 2016 12:55
Show Gist options
  • Save danricho/d94d69e39cf2ad68334c4d163271bb3f to your computer and use it in GitHub Desktop.
Save danricho/d94d69e39cf2ad68334c4d163271bb3f to your computer and use it in GitHub Desktop.
import time
import threading
import gremlin
from vjoy.vjoy import AxisName
# Implement using recurring timer
def slider_update_timer():
vjoy = gremlin.input_devices.VJoyProxy()
joy = gremlin.input_devices.JoystickProxy()
left_value = joy[0].axis(4) # LEFT STICK IS ZERO!!!!
right_value = joy[1].axis(4) # RIGHT STICK
# JITTER
if (left_value < 0):
vjoy[1].axis[AxisName.SL0].value = (left_value + 0.001)
else:
vjoy[1].axis[AxisName.SL0].value = (left_value - 0.001)
if (right_value < 1):
vjoy[2].axis[AxisName.SL0].value = (right_value + 0.001)
else:
vjoy[2].axis[AxisName.SL0].value = (right_value - 0.001)
time.sleep(0.05)
vjoy[1].axis[AxisName.SL0].value = left_value
vjoy[2].axis[AxisName.SL0].value = right_value
threading.Timer(0.5, slider_update_timer).start()
slider_update_timer()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment