Initialize git
This commit is contained in:
22
monitor.py
Normal file
22
monitor.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import serial
|
||||
import time
|
||||
import sys
|
||||
|
||||
port = "COM5"
|
||||
baudrate = 115200
|
||||
|
||||
print(f"Waiting for {port}...")
|
||||
while True:
|
||||
try:
|
||||
with serial.Serial(port, baudrate, timeout=1) as ser:
|
||||
print("Connected! Reading...")
|
||||
while True:
|
||||
line = ser.readline()
|
||||
if line:
|
||||
try:
|
||||
print(line.decode('utf-8', errors='replace'), end='', flush=True)
|
||||
except:
|
||||
pass
|
||||
except serial.SerialException as e:
|
||||
print(f"Exception: {e}")
|
||||
time.sleep(0.5)
|
||||
Reference in New Issue
Block a user