Created
July 28, 2015 05:31
-
-
Save skfwMelonpan/67f12fc3aeab57ab7fe4 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
#!/usr/bin/python | |
import sys | |
import serial | |
import time | |
import datetime | |
ser=serial.Serial("/dev/ttyAMA0",9600) | |
start = datetime.datetime.now() | |
end = start+datetime.timedelta(seconds=60) | |
print start | |
while True: | |
line=ser.readline() | |
print "%s,%s"%(datetime.datetime.now()-start,line) | |
if end-datetime.datetime.now()<datetime.timedelta(seconds=0): | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment