AdamLaurie / RFIDIOt

python RFID / NFC library & tools
http://www.rfidiot.org/
1.05k stars 222 forks source link

Other serial stuff blocking the rfid readers #9

Closed bskrt closed 11 years ago

bskrt commented 11 years ago

Hi Adam,

Currently working on a project which uses your awesome lib to read out two touchatag readers (using libnfc). I've ran into a problem though. We also need to read out another serial data coming from an arduino, but whenever I start a serial.read() (one the arduino port) the readers stall.

In our while loop we have: while 42: msg = ser.readline().strip() if card1.select():

dostuff

    if card2.select():
        #dostuff

If we remove the ser.readline() the readers work fine, whenever it's there, the readers stall.

Any idea what's causing this?

Thanks a bunch, Kevin

bskrt commented 11 years ago

Fixed my own problem which had nothing to do with your lib but with me being very green at python.

For reference sake I used threading to split both actions which fixed the issued.

class SerialThread (threading.Thread):
    def __init__(self):
    threading.Thread.__init__(self)
def run (self):
    global msg
    ser = serial.Serial('/dev/ttyUSB1', 57600)
    while 1:
        msg = valueser.readline().strip()

SerialThread().start()