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
| #!/usr/bin/env python
#
print ("Starting program")
import serial
#import MAX3100 as COM
import time
# import string
#
count = 1
myin = "1"
test=serial.Serial("COM6",9600,timeout=5)
test.close()
test.open()
teststring = "5"
#
try:
while True:
print (count, teststring)
test.write(int(myin))<-----pb
print ("Waiting 5 second")
time.sleep(5)
#myin = test.readline()
#print("recieved :"+myin)
count = count + 1
#
except KeyboardInterrupt:
pass # do cleanup here
#
test.close() |