Skip to content

Instantly share code, notes, and snippets.

@jkirklan
Created January 6, 2020 18:25
Show Gist options
  • Save jkirklan/bbd277016da3973a744652604815dde1 to your computer and use it in GitHub Desktop.
Save jkirklan/bbd277016da3973a744652604815dde1 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import serial
ser = serial.Serial(
port='COM5',\
baudrate=9600,\
parity=serial.PARITY_NONE,\
stopbits=serial.STOPBITS_ONE,\
bytesize=serial.EIGHTBITS,\
timeout=0)
print("connected to: " + ser.portstr)
count=1
while True:
for line in ser.read():
print(str(count) + str(': ') + chr(line) )
count = count+1
ser.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment