add serial port reading
--- a/scannr.py
+++ b/scannr.py
@@ -8,6 +8,8 @@
import threading
from pydispatch import dispatcher
import wave
+import serial
+#python -m serial.tools.miniterm -p COM20 -e -b 115200 --cr
filename = "demo.wav"
MIN_LENGTH = 90000
@@ -20,7 +22,9 @@
http://stackoverflow.com/questions/2559746/getting-error-while-converting-wav-to-amr-using-ffmpeg
"""
print 'Worker for '+filename
-
+ ser.write("GLG\r")
+ line = ser.readline() # read a '\n' terminated line
+ print line
return
def filenameMaker():
@@ -45,8 +49,11 @@
dispatcher.connect( filenameMaker, signal='SND_STARTED', sender=dispatcher.Any )
dispatcher.connect( worker, signal='FILE_CREATED', sender=dispatcher.Any )
+
+ser = serial.Serial('COM20', 112500, timeout=1)
+
print "Scannr started..."
while True:
print "ready to record"
record_to_async_file()
-
+ser.close()