-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocalClient.py
More file actions
36 lines (24 loc) · 827 Bytes
/
localClient.py
File metadata and controls
36 lines (24 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import time
from RC28Controller import RC28Controller
def local_client():
controller = RC28Controller()
def on_button_press(button):
print(f"Button {button} pressed")
def on_button_release():
print("Button released")
def on_wheel(val):
print(f"Wheel: {val}")
controller.register_callback("button_press", on_button_press)
controller.register_callback("button_release", on_button_release)
controller.register_callback("wheel", on_wheel)
# Example: Turn on all lights
controller.set_lights(True, True, True)
time.sleep(2)
controller.set_lights(False, False, False)
try:
while True:
time.sleep(1) # Keep the client running
except KeyboardInterrupt:
controller.close()
if __name__ == "__main__":
local_client()