Skip to content

Commit

Permalink
Update controller example, add ignore of dll files
Browse files Browse the repository at this point in the history
  • Loading branch information
flok committed Dec 26, 2023
1 parent fc60c0f commit 0596a4a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/read_controller.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from pydualsense import *

RUNNING = True


def cross_down(state):
print(f'cross {state}')
Expand All @@ -20,6 +22,10 @@ def joystick(stateX, stateY):
def gyro_changed(pitch, yaw, roll):
print(f'{pitch}, {yaw}, {roll}')

def r1_pressed(state):
global RUNNING
RUNNING = not RUNNING


# create dualsense
dualsense = pydualsense()
Expand All @@ -32,9 +38,10 @@ def gyro_changed(pitch, yaw, roll):
dualsense.dpad_down += dpad_down
dualsense.left_joystick_changed += joystick
dualsense.gyro_changed += gyro_changed
dualsense.r1_changed += r1_pressed

# read controller state until R1 is pressed
while not dualsense.state.R1:
while RUNNING:
...

# close device
Expand Down

0 comments on commit 0596a4a

Please sign in to comment.