Skip to content

Commit

Permalink
Servo command stream - added semicolon as command separator
Browse files Browse the repository at this point in the history
  • Loading branch information
koleo9am committed May 8, 2021
1 parent 8ac8339 commit fea3680
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mqtt_io/modules/stream/servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import time
import re

from typing import Optional

Expand Down Expand Up @@ -54,8 +55,8 @@ def read(self) -> Optional[bytes]:

def write(self, data: bytes) -> None:
# spliy by new lines
commands = data.decode('UTF-8')
for command in commands.split ("\n"):
commands = re.split(';\n', data.decode('UTF-8'))
for command in commands:
if command == COMMAND_MIN:
self.servo.min()
elif command == COMMAND_MAX:
Expand Down

0 comments on commit fea3680

Please sign in to comment.