I am trying to send this command ":01050801FF00F2" over serial in python 2.7 , with no success. The code that i use is :
import serial, sys ,socket
from time import sleep
port = "COM9"
baudRate = 9600
try:
ser = serial.Serial(port, baudRate, timeout=1)
if not ser.isOpen():
ser.open()
except Exception, e:
print("Error opening com port. Quitting."+str(e))
sys.exit(0)
print("Opening " + ser.portstr)
#this is few ways i am trying to send with
c = '01050801FF00F2'
ser.write(c.encode('utf-8'))
sleep(3)
ser.flushInput() #flush input buffer, discarding all its contents
ser.flushOutput()#flush output buffer, aborting current output
#and discard all that is in buffer
c = ':01050801FF00F2'
ser.write(c.encode('hex'))
sleep(3)
ser.write(':01050801FF00F2')