Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
read dylos pm2.5/pm10 data
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