MFRC522/lib/usart/term.py

13 lines
331 B
Python
Raw Normal View History

2020-12-10 21:17:19 +00:00
import serial
from time import sleep
with serial.Serial('/dev/ttyUSB0', 9600, timeout=1) as ser:
ser.write(b'a')
while True:
x = ser.read() # read one byte
if x != b'':
pass
print(x.decode('utf'))
#ser.write(b'a')
#print(ser.read())
sleep(1)