upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions | Protected Member Functions | Protected Attributes
Servo Class Reference

Public Member Functions

 Servo (int pin)
 
 Servo (int pin, int minPulseWidth, int maxPulseWidth)
 
 Servo (int pin, int minPulseWidth, int maxPulseWidth, int waitAndDisablePwm)
 
 ~Servo ()
 
mraa_result_t setAngle (int angle)
 
mraa_result_t haltPwm ()
 
std::string name ()
 
void setMinPulseWidth (int width)
 
void setMaxPulseWidth (int width)
 
void setPeriod (int period)
 
int getMinPulseWidth ()
 
int getMaxPulseWidth ()
 
int getPeriod ()
 

Protected Member Functions

int calcPulseTraveling (int value)
 

Protected Attributes

std::string m_name
 
int m_servoPin
 
float m_maxAngle
 
mraa_pwm_context m_pwmServoContext
 
int m_currAngle
 
int m_minPulseWidth
 
int m_maxPulseWidth
 
int m_period
 
int m_waitAndDisablePwm
 

Constructor & Destructor Documentation

Servo ( int  pin)

Instantiates a Servo object

Parameters
pinServo pin number
Servo ( int  pin,
int  minPulseWidth,
int  maxPulseWidth 
)

Instantiates a Servo object

Parameters
pinServo pin number
minPulseWidthMinimum pulse width, in microseconds
maxPulseWidthMaximum pulse width, in microseconds
Servo ( int  pin,
int  minPulseWidth,
int  maxPulseWidth,
int  waitAndDisablePwm 
)

Instantiates a Servo object

Parameters
pinServo pin number
minPulseWidthMinimum pulse width, in microseconds
maxPulseWidthMaximum pulse width, in microseconds
waitAndDisablePwmIf 1, PWM is enabled only during the setAngle() execution for a period of 1 second, and then turned back off. If 0, PWM remains on afterward.
~Servo ( )

Servo object destructor

Here is the call graph for this function:

Member Function Documentation

mraa_result_t setAngle ( int  angle)

Sets the angle of the servo engine.

Parameters
angleNumber between 0 and 180
Returns
0 if successful, non-zero otherwise

Here is the call graph for this function:

Here is the caller graph for this function:

mraa_result_t haltPwm ( )

Halts PWM for this servo and allows it to move freely.

Here is the caller graph for this function:

std::string name ( )
inline

Returns the name of the component

Returns
Name of the component

Here is the call graph for this function:

void setMinPulseWidth ( int  width)

Sets the minimum pulse width

Parameters
widthMinimum HIGH signal width

Here is the caller graph for this function:

void setMaxPulseWidth ( int  width)

Sets the maximum pulse width

Parameters
widthMaximum HIGH signal width

Here is the caller graph for this function:

void setPeriod ( int  period)

Sets the maximum period width

Parameters
periodPWM period width

Here is the caller graph for this function:

int getMinPulseWidth ( )

Returns the minimum pulse width

Returns
Minimum pulse width

Here is the caller graph for this function:

int getMaxPulseWidth ( )

Returns the maximum pulse width

Returns
Maximum pulse width

Here is the caller graph for this function:

int getPeriod ( )

Returns the maximum PWM period width

Returns
Maximum PWM period width

Here is the call graph for this function:

Here is the caller graph for this function:

Inheritance diagram for Servo:
Inheritance graph
[legend]

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