Initial commit.
This commit is contained in:
commit
1985c99fbd
|
@ -0,0 +1 @@
|
|||
Interface for the arduino temperature logger. It is meant to be run on a machine connected to the arduino.
|
|
@ -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
|
Loading…
Reference in New Issue