upm  0.1.8
Sensor/Actuator repository for libmraa (v0.4.5)
 All Data Structures Files Functions Variables Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes
Servo Class Reference

Base class for other servo components. More...

Detailed Description

PMOD pins for MAX44000PMB1 board

Public Member Functions

 Servo (int pin)
 
 ~Servo ()
 
mraa_result_t setAngle (int angle)
 
std::string name ()
 
void setMinPulseWidth (int width)
 
void setMaxPulseWidth (int width)
 
void setMaxPeriod (int width)
 
int getMinPulseWidth ()
 
int getMaxPulseWidth ()
 
int getMaxPeriod ()
 

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_maxPeriod
 

Constructor & Destructor Documentation

Servo ( int  pin)

Instanciates a servo object

Parameters
pinservo pin number

Here is the call graph for this function:

~Servo ( )

Servo object destructor.

Member Function Documentation

mraa_result_t setAngle ( int  angle)

Set the of the servo engine.

X = between (MIN_PULSE_WIDTH , MAX_PULSE_WIDTH)

X usec


|_______________________________________ 20000 usec

Max period can be only 7968750(nses) which is ~8(msec) so the servo will not work as expected.

Parameters
anglenumber between 0 and 180

Here is the caller graph for this function:

std::string name ( )
inline

Return name of the component

void setMinPulseWidth ( int  width)

Set min pulse width

Parameters
widthHIGH signal width
void setMaxPulseWidth ( int  width)

Set max pulse width

Parameters
widthHIGH signal width
void setMaxPeriod ( int  width)

Set max period width

Parameters
widthPWM period width
int getMinPulseWidth ( )

Return min pulse width

int getMaxPulseWidth ( )

Return max pulse width

int getMaxPeriod ( )

Return max PWM period width

Inheritance diagram for Servo:
Inheritance graph
[legend]

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