Created
November 22, 2019 19:47
-
-
Save wesleyit/adce5cc23e1734f66719b2a9fd1bb2ce to your computer and use it in GitHub Desktop.
Read tags from RDM6300 on UART @ Linux
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
import time | |
import serial | |
s = serial.Serial('/dev/ttyUSB0', 9600) | |
latest_tag = 0 | |
while True: | |
tag_bytes = s.read(14) | |
print(tag_bytes) | |
tag = int(tag_bytes.decode()[4:11], base=16) | |
if latest_tag != tag: | |
print(tag) | |
latest_tag = tag | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment