Created
November 7, 2016 19:43
-
-
Save dapperfu/a311ee03e2498477fa2bd4dd12d03156 to your computer and use it in GitHub Desktop.
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 serial | |
import sys | |
import datetime | |
port = sys.argv[1] | |
try: | |
ser = serial.Serial(port=port, baudrate=115200, timeout=5) | |
while 1: | |
data = "{},{},{}".format(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"), | |
port, | |
ser.readline().decode().strip()) | |
print(data) | |
except KeyboardInterrupt: | |
pass | |
except: | |
raise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment