libwallaby  v23
The wallaby standard library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Servos

Functions

void enable_servo (int port)
 Enable a specific servo. More...
 
void disable_servo (int port)
 Disable a specific servo. More...
 
void enable_servos ()
 Enable all four servo channels. More...
 
void disable_servos ()
 Disable all four servo channels. More...
 
void set_servo_enabled (int port, int enabled)
 Enable or disable a specific servo. More...
 
int get_servo_enabled (int port)
 Check if a servo is enabled. More...
 
int get_servo_position (int port)
 Get the most recent commanded servo position. More...
 
void set_servo_position (int port, int position)
 Set a new servo goal position. More...
 

Detailed Description

Function Documentation

void disable_servo ( int  port)

Disable a specific servo.

Parameters
[in]portThe port, between 0 and 3, to disable
void disable_servos ( )

Disable all four servo channels.

void enable_servo ( int  port)

Enable a specific servo.

Parameters
[in]portThe port, between 0 and 3, to enable
void enable_servos ( )

Enable all four servo channels.

int get_servo_enabled ( int  port)

Check if a servo is enabled.

Parameters
[in]portThe port, between 0 and 3
Returns
The servo enable setting 0: disabled 1: enabled
int get_servo_position ( int  port)

Get the most recent commanded servo position.

Parameters
servoThe port of the servo
Returns
The servo's position as an 11 bit integer (which is an integer between 0 and 2047)
Note
This method will return the last sent position, not the currently set position.
void set_servo_enabled ( int  port,
int  enabled 
)

Enable or disable a specific servo.

Parameters
[in]portThe port, between 0 and 3, to enable
[in]enabledThe new enable setting 0: disabled 1: enabled
void set_servo_position ( int  port,
int  position 
)

Set a new servo goal position.

Parameters
servoThe port of the servo
positionThe new servo position, between 0 and 2047
Note
Even though the servos have a theoretical range between 0 and 2047, the actual range is often less. Setting the servo to a position that it cannot physically reach will cause the servo to audibly strain and will consume battery very quickly.