Hello,
I have a pololu maestro 18 channel servo controller . I have written a python code to control the maestro via pc using serial bluetooth HC 05
first of all I have made a library like this
code /
class Controller :
self.PololuCmd = "0xaa" + "0xc"
def setTarget(self, chan, target):
lsb = target & 0x7f #7 bits for least significant byte
msb = (target >> 7) & 0x7f #shift 7 and take next 7 bits for msb
# Send Pololu intro, device number, command, channel, and target lsb/msb
cmd = self.PololuCmd + "0x04" + hex(chan) + hex(lsb) + hex(msb)
self.usb.write(cmd)
/ code
it is not full code but a logic
this seems to work
when i use this library
like this
code /
import maestro
maestro = maestro.Controller()
maestro.setTarget(0,9000) #moves to max angle
/ code
but when i want to set targets at multiple channels
like this
code/
import maestro
maestro = maestro.Controller()
maestro.setTarget(0,9000) #moves to max angle
maestro.setTarget(1,9000)
/code
this will successfully set servo 1 to max angle
but servo 0 will not have any effect
like it haven’t received any commands for servo 0
and this also happens vice versa
maestro.setTarget(1,9000) #moves to max angle
maestro.setTarget(0,9000)
in this case servo 0 moves to max angle
i think the problem is somewhere in sending some bytes
i mean it only understands ending commands
also there is a serial error of 0x0010 this lights up red led always
i have used set multiple target command and it also works for both servo
but set target method doesnt work for me
any help would be appreciated