Public Member Functions | |
MiniMaestro (Stream &stream, uint8_t resetPin=noResetPin, uint8_t deviceNumber=deviceNumberDefault, bool CRCEnabled=false) | |
Create a MiniMaestro object. More... | |
void | setPWM (uint16_t onTime, uint16_t period) |
Sets the PWM specified by onTime and period in units of 1/48 microseconds. More... | |
void | setMultiTarget (uint8_t numberOfTargets, uint8_t firstChannel, uint16_t *targetList) |
Sets multiple targets starting with the channel specified by firstChannel to a list of values listed in targetList for a contiguous block of channels specified by numberOfTargets. More... | |
void | reset () |
Resets the Maestro by toggling the resetPin , if a resetPin was given. More... | |
void | setTargetMiniSSC (uint8_t channelNumber, uint8_t target) |
Sets the target of the servo on channelNumber using the Mini SSC protocol. More... | |
void | setTarget (uint8_t channelNumber, uint16_t target) |
Sets the target of the servo on channelNumber. More... | |
void | setSpeed (uint8_t channelNumber, uint16_t speed) |
Sets the speed limit of channelNumber. More... | |
void | setAcceleration (uint8_t channelNumber, uint16_t acceleration) |
Sets the acceleration limit of channelNumber. More... | |
void | goHome () |
Sends the servos and outputs to home position. More... | |
void | stopScript () |
Stops the script. More... | |
void | restartScript (uint8_t subroutineNumber) |
Starts loaded script at specified subroutineNumber location. More... | |
void | restartScriptWithParameter (uint8_t subroutineNumber, uint16_t parameter) |
Starts loaded script at specified subroutineNumber location after loading parameter on to the stack. More... | |
uint16_t | getPosition (uint8_t channelNumber) |
Gets the position of channelNumber. More... | |
uint8_t | getMovingState () |
Gets the moving state for all configured servo channels. More... | |
uint8_t | getScriptStatus () |
Gets if the script is running or stopped. More... | |
uint16_t | getErrors () |
Gets the error register. More... | |
Static Public Attributes | |
static const uint8_t | deviceNumberDefault = 255 |
The default device number, used to construct a MicroMaestro or MiniMaestro object that will use the compact protocol. | |
static const uint8_t | noResetPin = 255 |
The default reset pin is no reset pin, used to construct a MicroMaestro or MiniMaestro object that will not have a reset pin. | |
Definition at line 307 of file PololuMaestro.h.
MiniMaestro::MiniMaestro | ( | Stream & | stream, |
uint8_t | resetPin = noResetPin , |
||
uint8_t | deviceNumber = deviceNumberDefault , |
||
bool | CRCEnabled = false |
||
) |
Create a MiniMaestro object.
stream | A class that descends from Stream, like SoftwareSerial or one of the Hardware Serial ports. |
resetPin | The pin used by reset() to reset the Maestro. The default value is Maestro::noResetPin, which makes reset() do nothing. |
deviceNumber | The device number configured on the Serial Settings tab in the Maestro Control Center. When deviceNumber is anything but Maestro::deviceNumberDefault, the Maestro communicates via the Pololu protocol. Otherwise, it uses the Compact protocol. |
CRCEnabled | When true, the object computes the CRC value for a command packet and sends it at the end. The Maestro also has to have the Enable CRC option checked on the Serial Settings tab of the Maestro Control Center. |
The MiniMaestro object adds serial commands only availabe on the Mini Maestro servo controllers: setPWM and setMultiTarget.
Definition at line 191 of file PololuMaestro.cpp.
|
inherited |
Gets the error register.
Returns the error register in two bytes then all the error bits are cleared on the Maestro. See the Errors section of the Maestro User's Guide for more details.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 109 of file PololuMaestro.cpp.
|
inherited |
Gets the moving state for all configured servo channels.
Determines if the servo outputs have reached their targets or are still changing and will return 1 as as long as there is at least one servo that is limited by a speed or acceleration setting.
See the Serial Interface section in the Maestro User's Guide for more details.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 100 of file PololuMaestro.cpp.
|
inherited |
Gets the position of channelNumber.
channelNumber | A servo number from 0 to 127. |
If channel is configured as a servo, then the position value represents the current pulse width transmitted on the channel in units of quarter-microseconds.
If the channel is configured as a digital output, a position value less than 6000 means the Maestro is driving the line low, while a position value of 6000 or greater means the Maestro is driving the line high.
If channel is configured as an input, then the position value represents the voltage measured. Analog inputs for channels 0-11: their values range from 0 to 1023, representing 0 to 5V. Digital inputs for channels 12-23: their values are exactly 0 or exactly 1023.
See the Serial Interface section in the Maestro User's Guide for more details.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 88 of file PololuMaestro.cpp.
|
inherited |
Gets if the script is running or stopped.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 120 of file PololuMaestro.cpp.
|
inherited |
Sends the servos and outputs to home position.
If the "On startup or error" setting for a servo or output channel is set to "Ignore", the position will be unchanged.
See the Serial Interface section in the Maestro User's Guide for more details.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 36 of file PololuMaestro.cpp.
|
inherited |
Resets the Maestro by toggling the resetPin
, if a resetPin
was given.
By default this function will do nothing. If the resetPin
was specified while constructing the Maestro object, it will toggle that pin. That pin needs to be wired to the Maestro's RST pin for it to reset the servo controller.
Definition at line 16 of file PololuMaestro.cpp.
|
inherited |
Starts loaded script at specified subroutineNumber location.
subroutineNumber | A subroutine number defined in script's compiled code. |
Starts the loaded script at location specified by the subroutine number. Subroutines are numbered in the order they are defined in loaded script. Click the "View Compiled Code..." button and look at the subroutine list to find the number for a particular subroutine.
See the Serial Interface section in the Maestro User's Guide for more details.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 48 of file PololuMaestro.cpp.
|
inherited |
Starts loaded script at specified subroutineNumber location after loading parameter on to the stack.
subroutineNumber | A subroutine number defined in script's compiled code. |
parameter | A number from 0 to 16383. |
Similar to the restartScript
function, except it loads the parameter on to the stack before starting the script at the specified subroutine number location.
See the Serial Interface section in the Maestro User's Guide for more details.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 55 of file PololuMaestro.cpp.
|
inherited |
Sets the acceleration limit of channelNumber.
channelNumber | A servo number from 0 to 127. |
acceleration | A number from 0 to 16383. |
Limits the acceleration a servo channel’s output value changes.
See the Serial Interface section in the Maestro User's Guide for more details.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 80 of file PololuMaestro.cpp.
void MiniMaestro::setMultiTarget | ( | uint8_t | numberOfTargets, |
uint8_t | firstChannel, | ||
uint16_t * | targetList | ||
) |
Sets multiple targets starting with the channel specified by firstChannel to a list of values listed in targetList for a contiguous block of channels specified by numberOfTargets.
numberOfTargets | A number from 0 to 24. |
firstChannel | A channel number from 0 to (24 - numberOfTargets) |
targetList | An array of numbers from 0 to 16383. |
The target value representation based on the channel's configuration (servo and output) is the same as the Set Target command.
See the Serial Interface section in the Maestro User's Guide for more details.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 209 of file PololuMaestro.cpp.
void MiniMaestro::setPWM | ( | uint16_t | onTime, |
uint16_t | period | ||
) |
Sets the PWM specified by onTime and period in units of 1/48 microseconds.
onTime | A number from 0 to 16320. |
period | A number from 4 to 16384. |
Sets the PWM output to the specified on time and period, in units of 1/48 microseconds.
See the Serial Interface section in the Maestro User's Guide for more details.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 201 of file PololuMaestro.cpp.
|
inherited |
Sets the speed limit of channelNumber.
channelNumber | A servo number from 0 to 127. |
speed | A number from 0 to 16383. |
Limits the speed a servo channel’s output value changes.
See the Serial Interface section in the Maestro User's Guide for more details.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 72 of file PololuMaestro.cpp.
|
inherited |
Sets the target of the servo on channelNumber.
channelNumber | A servo number from 0 to 127. |
target | A number from 0 to 16383. |
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.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 64 of file PololuMaestro.cpp.
|
inherited |
Sets the target of the servo on channelNumber using the Mini SSC protocol.
channelNumber | A servo number from 0 to 254. |
target | A target position from 0 to 254. |
Definition at line 29 of file PololuMaestro.cpp.
|
inherited |
Stops the script.
Stops the script, if it is currently running.
See the Serial Interface section in the Maestro User's Guide for more details.
The compact protocol is used by default. If the deviceNumber was given to the constructor, it uses the Pololu protocol.
Definition at line 42 of file PololuMaestro.cpp.