Library for Pololu Maestro Servo Controller http://www.pololu.com/docs/0J40

Embed: (wiki syntax)

« Back to documentation index

Maestro Class Reference

Maestro Class Reference

Pololu Maestro Servo Controller. More...

#include <Maestro.h>

Public Member Functions

 Maestro (PinName tx, PinName rx)
 Constructor.
void setBaudRate (uint16_t baud)
 Sets baud rate.
void setTarget (uint8_t channel, uint16_t target)
 Sets the target of a channel to a specified value.
void setServoAngle (uint8_t channel, int8_t angle)
 Sets specified channel's servo to a specified angle.
void setMultipleTargets (uint8_t firstChannel, uint8_t count, uint16_t *targets)
 Simultaneously sets the targets for a contiguous block of channels.
void setServosAngles (uint8_t firstChannel, uint8_t count, int8_t *angles)
 Simultaneously sets specified contiguous block of servo channels to a specified angles.
void setSpeed (uint8_t channel, uint16_t speed)
 Limits the speed at which a servo channel's output value changes.
void setSpeed (uint16_t speed)
 Limits the speed at which all servos channels output value changes.
void setAcceleration (uint8_t channel, uint16_t acceleration)
 Limits the acceleration of a servo channel's output.
void setAcceleration (uint16_t acceleration)
 Limits the acceleration of all servos channels output.
void setPWM (uint8_t channel, uint16_t time, uint16_t period)
 Sets the PWM output to the specified on time and period.
uint16_t getPosition (uint8_t channel)
 Gets current servo position.
bool getMovingState ()
 Determine whether the servo outputs have reached their targets or are still changing.
uint16_t getErrors ()
 Examine the errors that the Maestro has detected.
void goHome ()
 Send all servos and outputs to their home positions.

Detailed Description

Pololu Maestro Servo Controller.

Definition at line 64 of file Maestro.h.


Constructor & Destructor Documentation

Maestro ( PinName  tx,
PinName  rx 
)

Constructor.

Parameters:
tx- mbed pin to use for TX serial line
rx- mbed pin to use for RX serial line
Author:
Przemyslaw Kochanski <przemyslaw@kochanski.biz>

LICENSE

Copyright (C) 2014 Przemyslaw Kochanski, MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

DESCRIPTION

Library for Pololu Maestro Servo Controller Serial Servo Commands: http://www.pololu.com/docs/0J40/5.e

Definition at line 31 of file Maestro.cpp.


Member Function Documentation

uint16_t getErrors (  )

Examine the errors that the Maestro has detected.

Returns:
- error bits

Definition at line 132 of file Maestro.cpp.

bool getMovingState (  )

Determine whether the servo outputs have reached their targets or are still changing.

Returns:
- true if servos are moving, false otherwise

Definition at line 126 of file Maestro.cpp.

uint16_t getPosition ( uint8_t  channel )

Gets current servo position.

Parameters:
channel- number of a servo channel
Returns:
- current pulse width that the Maestro is transmitting on the channel

Definition at line 119 of file Maestro.cpp.

void goHome (  )

Send all servos and outputs to their home positions.

Definition at line 138 of file Maestro.cpp.

void setAcceleration ( uint8_t  channel,
uint16_t  acceleration 
)

Limits the acceleration of a servo channel's output.

Parameters:
channel- number of a servo channel
acceleration- acceleration of the servo in units of (0.25 us) / (10 ms) / (80 ms)

Definition at line 94 of file Maestro.cpp.

void setAcceleration ( uint16_t  acceleration )

Limits the acceleration of all servos channels output.

Parameters:
acceleration- acceleration of the servo in units of (0.25 us) / (10 ms) / (80 ms)

Definition at line 102 of file Maestro.cpp.

void setBaudRate ( uint16_t  baud )

Sets baud rate.

Parameters:
baud- Baud Rate to be set

Definition at line 36 of file Maestro.cpp.

void setMultipleTargets ( uint8_t  firstChannel,
uint8_t  count,
uint16_t *  targets 
)

Simultaneously sets the targets for a contiguous block of channels.

Parameters:
count- number of channels in the contiguous block
firstChannel- lowest channel number in the contiguous block
target- target values (the pulse width to transmit in units of quarter-microseconds) for each of the channels, in order by channel number

Definition at line 55 of file Maestro.cpp.

void setPWM ( uint8_t  channel,
uint16_t  time,
uint16_t  period 
)

Sets the PWM output to the specified on time and period.

Parameters:
channel- number of a servo channel
time- time in units of 1/48 us
period- period in units of 1/48 us

Definition at line 109 of file Maestro.cpp.

void setServoAngle ( uint8_t  channel,
int8_t  angle 
)

Sets specified channel's servo to a specified angle.

Parameters:
channel- number a servo channel
angle- target angle of a servo

Definition at line 50 of file Maestro.cpp.

void setServosAngles ( uint8_t  firstChannel,
uint8_t  count,
int8_t *  angles 
)

Simultaneously sets specified contiguous block of servo channels to a specified angles.

Parameters:
count- number of servo channels in the contiguous block
firstChannel- lowest servo channel number in the contiguous block
angles- target values (the pulse width to transmit in units of quarter-microseconds) for each of the servo channels, in order by channel number

Definition at line 68 of file Maestro.cpp.

void setSpeed ( uint16_t  speed )

Limits the speed at which all servos channels output value changes.

Parameters:
speed- speed of the servo in units of 0.25 us / (10 ms)

Definition at line 87 of file Maestro.cpp.

void setSpeed ( uint8_t  channel,
uint16_t  speed 
)

Limits the speed at which a servo channel's output value changes.

Parameters:
channel- number of a servo channel
speed- speed of the servo in units of 0.25 us / (10 ms)

Definition at line 79 of file Maestro.cpp.

void setTarget ( uint8_t  channel,
uint16_t  target 
)

Sets the target of a channel to a specified value.

Parameters:
channel- number a servo channel
target- the pulse width to transmit in units of quarter-microseconds

Definition at line 42 of file Maestro.cpp.