SWRMeter/tools/test.py

12 lines
279 B
Python

import serial, sys
port = "/dev/ttyUSB0"
baudrate = 115200
ser = serial.Serial(port,baudrate,timeout=0.001)
while True:
ser.write(bytearray([0x3c, 0x3e, 0x10, 0x0d, 0x0a]))
if ser.inWaiting() > 0:
data = list(ser.read(64))
print data
sys.stdout.flush()