Has anyone had experience with controlling the Pololu Maestro Servo Controller ( http://www.pololu.com/catalog/product/1352 )??? A library would be handy.. (I'm not that great at creating them...plus there's a lot of conversions that trip me up....) I found this ( http://mbed.org/users/Torsten/programs/pololu_class/lhb1d6/docs/main_8cpp_source.html ) and it looks like the compact control code...or the older code....doesn't seem to work with this device.....
Any help or word in the right direction would be really appreciated!!! (this is my last step in getting this quad copter off the ground!)
If not, can someone lend a hand on converting the decimal value for the servo position into the binary numbers required?
The Maestro has several serial commands for setting the target of a channel, getting its current position, and setting its
speed and acceleration limits.
Set Target (Pololu/Compact protocol)
Compact protocol: 0x84, channel number, target low bits, target high bits
Pololu protocol: 0xAA, device number, 0x04, channel number, target low bits, target high bits
The lower 7 bits of the third data byte represent bits 0–6 of the target (the lower 7 bits), while the lower 7 bits of the
fourth data byte represent bits 7–13 of the target. The target is a non-negative integer.
If the channel is configured as a servo, then the target represents the pulse width to transmit in units of quarter-
microseconds. A target value of 0 tells the Maestro to stop sending pulses to the servo.
If the channel is configured as a digital output, values less than 6000 tell the Maestro to drive the line low, while values
of 6000 or greater tell the Maestro to drive the line high.
For example, if channel 2 is configured as a servo and you want to set its target to 1500 µs (1500×4 = 6000 =
01011101110000 in binary), you could send the following byte sequence:
Here is some example C code that will generate the correct serial bytes, given an integer “channel” that holds the channel
number, an integer “target” that holds the desired target (in units of quarter microseconds if this is a servo channel) and
an array called serialBytes:
Anyone have a suggestion on how to code that...? If I need 1500us, I can multiple that by 4 and get the 6000... but then how do I write the code to get the msb lsb in binary from that and push that out a serial port to the maestro device?
Any help is really appreciated.. I've been attacked by this thing twice now.. It's going for blood.... lol
Please log in to post a reply.
mbed, the fastest way to prototype with ARM based microcontrollers.
^ back to top