20 lines
443 B
Python
20 lines
443 B
Python
|
import serial
|
||
|
import mtrreader
|
||
|
from rich import inspect
|
||
|
import mtrlog
|
||
|
from datetime import datetime
|
||
|
|
||
|
mtr = serial.Serial(port='/dev/ttyUSB0', baudrate=9600, timeout=40)
|
||
|
|
||
|
def main():
|
||
|
data = mtr.read_until(expected='FFFFFFFFFF', size=230)
|
||
|
print('START')
|
||
|
msg = mtrreader.MtrDataMessage(data)
|
||
|
f = mtrlog.MtrLogFormatter
|
||
|
print(f.format(f, msg, datetime.now()))
|
||
|
print('END')
|
||
|
main()
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|