Skip to content

Instantly share code, notes, and snippets.

@zonque
Last active May 4, 2016 11:33
Show Gist options
  • Save zonque/a7647dde1ac05189d03ff623857135e9 to your computer and use it in GitHub Desktop.
Save zonque/a7647dde1ac05189d03ff623857135e9 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import serial
import time
ser = serial.Serial(
port = '/dev/ttyACM0',\
baudrate = 9600,\
parity = serial.PARITY_NONE,\
stopbits = serial.STOPBITS_ONE,\
bytesize = serial.EIGHTBITS,\
timeout = 0)
print("Monitoring %s ..." % ser.portstr)
while True:
line = ser.readline()
if not line:
break
t = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())
print("[%s] %s" % (t, line.rstrip()))
ser.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment