Skip to content

Commit 2a2ff87

Browse files
committed
Update code.py
1 parent dc90899 commit 2a2ff87

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

BLE_Apple_Watch_Controller/code.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@
8585
# while BLE connected
8686
while ble.connected:
8787
position = encoder.position
88-
# if the encoder is turned to the right
89-
if position > last_position:
90-
kbd.send(Keycode.RIGHT_ARROW)
91-
# if the encoder is turned to the left
92-
if position < last_position:
93-
kbd.send(Keycode.LEFT_ARROW)
94-
# reset encoder position
9588
if position != last_position:
89+
# if the encoder is turned to the right
90+
if position > last_position:
91+
kbd.send(Keycode.RIGHT_ARROW)
92+
# if the encoder is turned to the left
93+
if position < last_position:
94+
kbd.send(Keycode.LEFT_ARROW)
95+
# reset encoder position
9696
last_position = position
9797
print(f"Position: {position}")
9898
for b in range(5):

0 commit comments

Comments
 (0)