Skip to content

Instantly share code, notes, and snippets.

@pawl
Created April 2, 2014 14:34
Show Gist options
  • Save pawl/9935400 to your computer and use it in GitHub Desktop.
Save pawl/9935400 to your computer and use it in GitHub Desktop.
Parallax USB RFID reader Python Code
#! /usr/bin/python
import serial
import time
ser = serial.Serial('/dev/ttyUSB0', 2400, timeout=1) # replace '/dev/ttyUSB0' with your port
while True:
response = ser.read(12)
if response <> "":
print "raw: " + str(response)
print "hex: " + str(response[-8:])
print "dec: " + str(int(response[-8:], 16))
time.sleep(1)
ser.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment