I am using this code, to read a string of alphanumeric digits from an Arduino with a RFID sensor connected.:
import serial
ser = serial.Serial('/dev/ttyACM0',9600)
s = [0]
while True:
read_serial=ser.readline()
s[0] = str(ser.readline())
print s[0]
print read_serial
The Arduino uses this code which just prints to serial the unique ID of the RFID tag each time its tapped on the reader click link for arduino code: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=179457
My issue is that the raspberry pi works and reads out the Unique id when tapped on the reader attached to the Arduino, but it only prints it every 2 times it's tapped on the reader.
I would really appreciate any help with this! Thanks very much kind internet people!!
Updated code using advice by user:
import serial
ser = serial.Serial('/dev/ttyACM0',9600)
s = [0]
while True:
read_serial = ser.readline()
s[0] = str(read_serial)
print s[0]
print read_serial
Now instantly printing each time, but printing twice!
.............
Final working Code:
import serial
ser = serial.Serial('/dev/ttyACM0',9600)
s = [0]
while True:
read_serial = ser.readline()
print read_serial