-
Notifications
You must be signed in to change notification settings - Fork 0
/
rdSerASKnull.py
52 lines (39 loc) · 1.1 KB
/
rdSerASKnull.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import serial
import time
import csv
import os
from timeit import default_timer as timer
# ser = serial.Serial('/dev/ttyACM0')
ser = serial.Serial('/dev/ttyACM1')
ser.flushInput()
k=-1;
m=0;
tStop=False
outF = open("test_data.csv","w")
tStrt = timer()
while True:
if k < 1:
print('Program Started!')
ser_bytes = ser.readline()
# lst3= ser_bytes.decode().split(',')
lb = len(ser_bytes)
outS = str(lb) + ' ' + str(ser_bytes)
print(outS)
print('\n')
# print(lst3)
outF.write(outS)
if (k > 30) and tStop:
tEnd = timer()
cmd = "aplay ~/Data/MorseCode/txt2morse-master/test/r.wav"
returned_value = os.system(cmd) # returns the exit code in unix
print('returned value:', returned_value)
print('dltT ' + str(tEnd-tStrt) + ' jSt ' + str(jSt))
break
k= k+1
if k > 3760:
tEnd = timer()
cmd = "aplay ~/Data/MorseCode/txt2morse-master/test/r.wav"
returned_value = os.system(cmd) # returns the exit code in unix
print('Max Count Reached!')
print('Time dltT ',tEnd-tStrt)
break