Added stick tilt functionality

This commit is contained in:
Brikwerk 2020-08-02 21:56:42 -07:00
commit 1619c96cd7
3 changed files with 57 additions and 2 deletions

13
demo.py
View file

@ -3,6 +3,7 @@ from random import randint
import nxbt
from nxbt import Buttons
from nxbt import Sticks
MACRO = """
LOOP 12
@ -78,7 +79,6 @@ if __name__ == "__main__":
# Select the last controller for input
controller_idx = controller_idxs[-1]
time.sleep(4)
# Wait for the switch to connect to the controller
nx.wait_for_connection(controller_idx)
@ -93,8 +93,17 @@ if __name__ == "__main__":
nx.stop_macro(controller_idx, macro_id)
print("Stopped Macro")
# Moving the selected home screen item two spaces to the right and back.
nx.tilt_stick(controller_idx, Sticks.RIGHT_STICK, 100, 0,
tilted=0.25, released=0.25)
nx.tilt_stick(controller_idx, Sticks.RIGHT_STICK, 100, 0,
tilted=0.25, released=0.25)
nx.tilt_stick(controller_idx, Sticks.RIGHT_STICK, -100, 0,
tilted=0.25, released=0.25)
nx.tilt_stick(controller_idx, Sticks.RIGHT_STICK, -100, 0,
tilted=0.25, released=0.25)
# Return to the "Change Grip/Order Screen"
time.sleep(2)
nx.press_buttons(controller_idx, [Buttons.A])
time.sleep(2)
nx.press_buttons(controller_idx, [Buttons.A])