Create a gist now

Instantly share code, notes, and snippets.

anonymous /
Created Jul 23, 2017

# -*- coding: utf-8 -*-
import serial
from datetime import datetime
ser = serial.Serial(port='/dev/ttyACM0', baudrate=38400, timeout=0.5)
file = 'test.csv'
line =
#infinity loop
while True:
if( ser.inWaiting() > 0 ):
data =
f = open(file, 'a')
print data
if( '\n' in data ):
now ='%Y/%m/%d %H:%M:%S, ')
print now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment