Hendrik Langer 4 years ago
parent
commit
7110ca4ad1
  1. 9
      raspberry/roberto/Serial.py

9
raspberry/roberto/Serial.py

@ -4,7 +4,7 @@ import threading
import serial
class Serial(object):
self._callbacks = dict()
_callbacks = dict()
def __init__(self, devicename='/dev/ttyUSB0', baudrate=115200):
self.devicename = devicename
@ -50,9 +50,10 @@ class Serial(object):
print(data)
command = data[0]
argument = data[2:]
cb = self._callbacks[command]
if cb:
cb(argument)
if command in data:
cb = self._callbacks[command]
if cb:
cb(argument)
except serial.SerialException:
pass

Loading…
Cancel
Save