Skip to content

Instantly share code, notes, and snippets.

@allfake
Last active December 28, 2015 09:39
Show Gist options
  • Save allfake/7480734 to your computer and use it in GitHub Desktop.
Save allfake/7480734 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# read more command
# http://www.elechouse.com/elechouse/images/product/13.56MHZ_RFID_Module/13.56MHZ_RFID_Manual.pdf
import serial
ser = serial.Serial(
port='/dev/tty.SLAB_USBtoUART',
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS
)
command = bytearray([0x02])
ser.write(command)
while 1:
while ser.inWaiting():
s = ser.read()
print(hex(ord(s)))
ser.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment