Maestro Servo Controller library
 All Classes Files Functions Variables
Public Member Functions | Static Public Attributes | List of all members
MiniMaestro Class Reference
Inheritance diagram for MiniMaestro:
Maestro

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.
 

Detailed Description

Definition at line 307 of file PololuMaestro.h.

Constructor & Destructor Documentation

MiniMaestro::MiniMaestro ( Stream &  stream,
uint8_t  resetPin = noResetPin,
uint8_t  deviceNumber = deviceNumberDefault,
bool  CRCEnabled = false 
)

Create a MiniMaestro object.

Parameters
streamA class that descends from Stream, like SoftwareSerial or one of the Hardware Serial ports.
resetPinThe pin used by reset() to reset the Maestro. The default value is Maestro::noResetPin, which makes reset() do nothing.
deviceNumberThe 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.
CRCEnabledWhen 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.

Member Function Documentation

uint16_t Maestro::getErrors ( )
inherited

Gets the error register.

Returns
Two-byte error code.

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.

uint8_t Maestro::getMovingState ( )
inherited

Gets the moving state for all configured servo channels.

Returns
1 if at least one servo limited by speed or acceleration is still moving, 0 if not.

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.

uint16_t Maestro::getPosition ( uint8_t  channelNumber)
inherited

Gets the position of channelNumber.

Parameters
channelNumberA servo number from 0 to 127.
Returns
two-byte position value

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.

uint8_t Maestro::getScriptStatus ( )
inherited

Gets if the script is running or stopped.

Returns
1 if script is stopped, 0 if running.

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.

void Maestro::goHome ( )
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.

void Maestro::reset ( )
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.

void Maestro::restartScript ( uint8_t  subroutineNumber)
inherited

Starts loaded script at specified subroutineNumber location.

Parameters
subroutineNumberA 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.

void Maestro::restartScriptWithParameter ( uint8_t  subroutineNumber,
uint16_t  parameter 
)
inherited

Starts loaded script at specified subroutineNumber location after loading parameter on to the stack.

Parameters
subroutineNumberA subroutine number defined in script's compiled code.
parameterA 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.

void Maestro::setAcceleration ( uint8_t  channelNumber,
uint16_t  acceleration 
)
inherited

Sets the acceleration limit of channelNumber.

Parameters
channelNumberA servo number from 0 to 127.
accelerationA 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.

Parameters
numberOfTargetsA number from 0 to 24.
firstChannelA channel number from 0 to (24 - numberOfTargets)
targetListAn 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.

Parameters
onTimeA number from 0 to 16320.
periodA 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.

void Maestro::setSpeed ( uint8_t  channelNumber,
uint16_t  speed 
)
inherited

Sets the speed limit of channelNumber.

Parameters
channelNumberA servo number from 0 to 127.
speedA 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.

void Maestro::setTarget ( uint8_t  channelNumber,
uint16_t  target 
)
inherited

Sets the target of the servo on channelNumber.

Parameters
channelNumberA servo number from 0 to 127.
targetA 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.

void Maestro::setTargetMiniSSC ( uint8_t  channelNumber,
uint8_t  target 
)
inherited

Sets the target of the servo on channelNumber using the Mini SSC protocol.

Parameters
channelNumberA servo number from 0 to 254.
targetA target position from 0 to 254.

Definition at line 29 of file PololuMaestro.cpp.

void Maestro::stopScript ( )
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.


The documentation for this class was generated from the following files: