Skip to content

Commit 4b43ed9

Browse files
peterpeter
authored andcommitted
add back sleeps. I will do a cleaner version in separate MR
1 parent 9759c12 commit 4b43ed9

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ with pyspacemouse.open() as device:
120120
### Callbacks
121121

122122
```python
123+
import pyspacemouse
124+
import time
125+
123126
# Button callback
124127
def on_button(state, buttons, pressed):
125128
print(f"Button {pressed} pressed!")

examples/02_callbacks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ def on_any_button(state, buttons):
4949

5050
while True:
5151
device.read() # Must call read() to process callbacks
52-
time.sleep(0.01) # NOTE: large sleeps can cause data to buffer
52+
time.sleep(0.01)

examples/03_multi_device.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
useful for dual-hand control or controlling multiple robots.
55
"""
66

7+
import time
8+
79
import pyspacemouse
810

911

@@ -39,6 +41,8 @@ def main():
3941
f"Right: x={right.x:+.2f} y={right.y:+.2f} z={right.z:+.2f}"
4042
)
4143

44+
time.sleep(0.01)
45+
4246

4347
if __name__ == "__main__":
4448
main()

0 commit comments

Comments
 (0)