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

3
raspberry/roberto/Serial.py

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

Loading…
Cancel
Save