Created
May 2, 2015 06:11
-
-
Save Jerry-Fix/6e2c9af226070c746394 to your computer and use it in GitHub Desktop.
read dylos pm2.5/pm10 data
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 time | |
import sys | |
port = serial.Serial("/dev/ttyUSB0", 9600) | |
while True: | |
with open("data.txt", "a") as f: | |
data = time.ctime() + "," + port.readline() | |
print data | |
f.write(data) | |
sys.stdout.flush() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment