Skip to content

Instantly share code, notes, and snippets.

@Jerry-Fix
Created May 2, 2015 06:11
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jerry-Fix/6e2c9af226070c746394 to your computer and use it in GitHub Desktop.
Save Jerry-Fix/6e2c9af226070c746394 to your computer and use it in GitHub Desktop.
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