libwallaby  v24
The wallaby standard library
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

◆ disable_servo()

void disable_servo ( int  port)

Disable a specific servo.

Parameters
[in]portThe port, between 0 and 3, to disable

◆ disable_servos()

void disable_servos ( )

Disable all four servo channels.

◆ enable_servo()

void enable_servo ( int  port)

Enable a specific servo.

Parameters
[in]portThe port, between 0 and 3, to enable

◆ enable_servos()

void enable_servos ( )

Enable all four servo channels.

◆ get_servo_enabled()

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

◆ get_servo_position()

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.

◆ set_servo_enabled()

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

◆ set_servo_position()

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.