21 lines
465 B
Python

import serial
import json
from rich import print
import time
while True:
try:
serial_port = serial.Serial('/dev/ttyS0', baudrate=115200)
while True:
try:
monitor_stats = json.loads(serial_port.readline())
print(monitor_stats)
time.sleep(1)
except Exception as e:
print(e)
break
except Exception as e:
print(e)
continue