Hi,
I’m currently writing an Python API for the Dobot M1. There seem to be some inconsistencies in the communication protocol. I am only able to turn on I/O ports 17 and 18, but not turn off. Here is my code:
dobot.set_iodo(17, 0, 1)
class SetIODO(Command):
def init(self, address, level, is_queued=False):
params_fmt = None
params_name = None
if is_queued:
params_fmt = ‘Q’
params_name = [‘queuedCmdIndex’]super(SetIODO, self).__init__(131, 1, 1 if is_queued else 0, params_fmt, params_name) self.params = struct.pack('QQ', address, level)
When running the command, this is the result:
Set range to 1
OrderedDict([('header', 43690), ('len', 10), ('id', 131), ('ctrl', 3), ('queuedCmdIndex', 2), ('checksum', 120)])
OrderedDict([('header', 43690), ('len', 10), ('id', 131), ('ctrl', 0), ('address', 17), ('level', 1), ('checksum', 0)])
OrderedDict([('header', 43690), ('len', 10), ('id', 131), ('ctrl', 3), ('queuedCmdIndex', 3), ('checksum', 119)])
OrderedDict([('header', 43690), ('len', 10), ('id', 131), ('ctrl', 0), ('address', 18), ('level', 1), ('checksum', 0)])
Set range to 0
OrderedDict([('header', 43690), ('len', 10), ('id', 131), ('ctrl', 3), ('queuedCmdIndex', 4), ('checksum', 118)])
OrderedDict([('header', 43690), ('len', 10), ('id', 131), ('ctrl', 0), ('address', 17), ('level', 1), ('checksum', 0)])
OrderedDict([('header', 43690), ('len', 10), ('id', 131), ('ctrl', 3), ('queuedCmdIndex', 5), ('checksum', 117)])
OrderedDict([('header', 43690), ('len', 10), ('id', 131), ('ctrl', 0), ('address', 18), ('level', 1), ('checksum', 0)])
How can I solve this problem?