Created
April 2, 2014 14:34
-
-
Save pawl/9935400 to your computer and use it in GitHub Desktop.
Parallax USB RFID reader Python Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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