I used the following code from this post
import serial
import time
serial = serial.Serial("/dev/ttyAMA0", baudrate=2400)
while True:
if serial.inWaiting() > 0:
read_result = serial.read(12)
print("Read card {0}" . format(read_result.decode(encoding='utf-8')))
print("Sleeping 2 seconds")
time.sleep(2)
serial.flushInput() # ignore errors, no data
but still get the same problem as the original poster where the initial tag scan reads and any subsequent tries are unsuccessful
output is as follows with error:
Read card 04193DCBD7
Sleeping in 2 seconds
Read card # notice second read empty
Sleeping in 2 seconds
Traceback (most recent call last):
File "/home/pi/Desktop/Test/TestRFID2.py", line 8, in <module>
print("Read card {0}" . format(read_result.decode(encoding='utf-8')))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 3: invalid start byte
Errors fall in different positions (i.e. 1, 2, or 3)
Have tried different scripts as well with same outcome. I have also disabled the serial console as described here.
