Add debugging method
This commit is contained in:
@@ -38,3 +38,13 @@ class SerialReader:
|
|||||||
if line:
|
if line:
|
||||||
data = line.decode('utf-8', errors='ignore')
|
data = line.decode('utf-8', errors='ignore')
|
||||||
self.__notify(data)
|
self.__notify(data)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
def callback(data):
|
||||||
|
print(data)
|
||||||
|
|
||||||
|
reader = SerialReader("/dev/ttyUSB1", 57600)
|
||||||
|
reader.subscribe(callback)
|
||||||
|
reader.start()
|
||||||
@@ -50,7 +50,6 @@ if __name__ == "__main__":
|
|||||||
print("Light sensor reader started.")
|
print("Light sensor reader started.")
|
||||||
|
|
||||||
app.run(host="0.0.0.0", port=5000, debug=False)
|
app.run(host="0.0.0.0", port=5000, debug=False)
|
||||||
print("Server started.")
|
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("Keyboard interrupt. Stopping app...")
|
print("Keyboard interrupt. Stopping app...")
|
||||||
|
|||||||
Reference in New Issue
Block a user