Files
zephyr_dsp/serial_debug.py

20 lines
540 B
Python

"""Quick diagnostic — just print what comes over serial."""
import sys
import serial
if len(sys.argv) < 2:
print(f"Usage: python {sys.argv[0]} <COM_PORT>")
sys.exit(1)
ser = serial.Serial(sys.argv[1], 115200, timeout=2)
print(f"Listening on {sys.argv[1]}...")
while True:
raw = ser.readline()
if raw:
line = raw.decode("utf-8", errors="replace").strip()
prefix = line[:20] if len(line) > 20 else line
print(f"[{len(line):5d} chars] {prefix}...")
else:
print("(timeout — no data)")