This commit is contained in:
2020-01-25 23:37:41 -08:00
parent 610bc546c9
commit bb754d409d
3 changed files with 37 additions and 13 deletions

16
listen-python Normal file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/python
import serial, string
output = " "
ser = serial.Serial('/dev/ttyUSB0', 9600, 8, 'N', 1, timeout=1)
while True:
while output != "":
output = ser.read(1)
print len(output)
try:
print int(output)
except ValueError:
print ":".join("{:02x}".format(ord(c)) for c in output)
print output
output = " "