sending ctrl chars using sio module
CHale
chale at texas.net
Sun Oct 10 17:14:07 EDT 1999
Hi all,
I am new to python and I am trying to send hex data strings out the serial
port. I am using the siomodule and python1.5.2.
I used the modem.py and it works fine talking to my modem. So I adapted it
to send control chars to my X10 cm11a controller - or at least that's what I
am attempting. So I am trying to send raw binary data out the serial port
using sio. Can anyone offer some advice here?
I tried using Serial.Port.cmd(self, str) - where str is a decimal list of
bytes [4,124].
By contrast, the modem app was sending strings of printable text.
It may not be relevant, but I am using the RSP_FIXEDLEN mode for response.
Could it be that the Serial.Port.cmd() is the wrong method to use? Is there
another more appropriate for binary data? or is the list object just the
wrong way to go about this?
Class snippet:
class CtrlrModule(Serial.Port):
<snip>
def cmd(self, str=''):
self._trace('cm11A.cmd')
cmdStrng = str
chkSum = str[0] + str[1]
# send it to port
print len(cmdStrng)
Serial.Port.cmd(self, str) # <*** the offending linecurrently
rsp = ok = Serial.Port.read(self,1)
More information about the Python-list
mailing list