Initial commit.

This commit is contained in:
Kienan Stewart 2014-12-08 16:35:55 -05:00
commit 1985c99fbd
2 changed files with 22 additions and 0 deletions

1
README Normal file
View File

@ -0,0 +1 @@
Interface for the arduino temperature logger. It is meant to be run on a machine connected to the arduino.

21
temp_log.py Executable file
View File

@ -0,0 +1,21 @@
#! /usr/bin/env python
import serial, sys, time, io
serialPort = '/dev/ttyACM0'
try:
serialPort = sys.argv[1]
except Exception, e:
pass
ser = serial.Serial(port=serialPort, baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS)
sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser))
ser.isOpen()
buffer = ''
while True:
try:
buffer = ser.readline()
buffer_split = buffer.split(' ')
temp = float(buffer_split[-2])
print unicode(time.time()) + ',' + unicode(temp)
sys.stdout.flush()
except Exception, e:
sys.stderr.write(str(e) + '\n')
continue