2014-12-29, 20:13
I have a Py script that controls my TV. I have posted about this before but didn't get much so I am trying a little different approach.
This is the ON command.
This works but occasinaly the TV dosent respond and I have to try again. Maybe two or three times. Once the TV does respond it sends data back.
This is what it should send:
But sometimes I get:
When I get extra data the 030cf100 is still there. So what I want is to do a loop, maybe setting the response as a variable until that response has the string 030cf100 in it somewhere.
Can anyone help me with this?
This is the ON command.
Code:
import time, serial
ser = serial.Serial(port='/dev/ttyUSB0', baudrate=9600, timeout=1)
ser.write("\x08\x22\x00\x00\x00\x02\xd4")
data = ser.read(24)
print data.encode('hex')
time.sleep(2)
ser.close()
This works but occasinaly the TV dosent respond and I have to try again. Maybe two or three times. Once the TV does respond it sends data back.
This is what it should send:
Code:
030cf100
But sometimes I get:
Code:
030cf1030cf100
or
ada103010001a6030cf100
When I get extra data the 030cf100 is still there. So what I want is to do a loop, maybe setting the response as a variable until that response has the string 030cf100 in it somewhere.
Can anyone help me with this?