Added button functionality and info
This commit is contained in:
parent
78e62fd013
commit
21f7f42cc9
14 changed files with 666 additions and 182 deletions
50
demo.py
50
demo.py
|
|
@ -3,13 +3,57 @@ import time
|
|||
from nxbt import Nxbt
|
||||
from nxbt import ControllerTypes
|
||||
|
||||
MACRO = """
|
||||
B 0.1s
|
||||
0.1s
|
||||
B 0.1s
|
||||
0.1s
|
||||
B 0.1s
|
||||
0.1s
|
||||
B 0.1s
|
||||
1.5s
|
||||
DPAD_LEFT 0.1s
|
||||
0.1s
|
||||
DPAD_LEFT 0.1s
|
||||
0.1s
|
||||
DPAD_LEFT 0.1s
|
||||
0.1s
|
||||
DPAD_LEFT 0.1s
|
||||
0.1s
|
||||
DPAD_LEFT 0.1s
|
||||
0.1s
|
||||
DPAD_RIGHT 0.075s
|
||||
0.075s
|
||||
DPAD_RIGHT 0.075s
|
||||
0.075s
|
||||
DPAD_RIGHT 0.075s
|
||||
0.075s
|
||||
A 0.1s
|
||||
1.5s
|
||||
A 0.1s
|
||||
"""
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
nxbt = Nxbt()
|
||||
adapters = nxbt.get_available_adapters()
|
||||
index = nxbt.create_controller(
|
||||
ControllerTypes.PRO_CONTROLLER, "/org/bluez/hci0")
|
||||
|
||||
ControllerTypes.PRO_CONTROLLER,
|
||||
adapters[0],
|
||||
colour_body=[0xFF, 0x7B, 0x83],
|
||||
colour_buttons=[0xFF, 0xF0, 0x78])
|
||||
index2 = nxbt.create_controller(
|
||||
ControllerTypes.PRO_CONTROLLER,
|
||||
adapters[1],
|
||||
colour_body=[0xFF, 0xFF, 0xFF],
|
||||
colour_buttons=[0xFF, 0xF0, 0x78])
|
||||
nxbt.macro(index2, MACRO, block=False)
|
||||
while True:
|
||||
time.sleep(1)
|
||||
print(nxbt.get_state()[0])
|
||||
state = nxbt.state[0]
|
||||
if not state["errors"]:
|
||||
print(state["finished_macros"])
|
||||
else:
|
||||
print(state["errors"])
|
||||
break
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue