Skip to content

Class evam::SoftwareServoDriver

template <int kPin, int kMinPulse, int kMiddlePulse, int kMaxPulse>

ClassList > evam > SoftwareServoDriver

Software-based servo driver using millis() for timing. More...

  • #include <evamSoftwareServoDriver.h>

Inherits the following classes: Tickable

Public Functions

Type Name
int GetPin () const
Get the servo pin number.
SoftwareServoDriver ()
Constructor. Initializes the pin as output.
SoftwareServoDriver (SoftwareServoConfig config, Args... args)

Protected Functions

Type Name
void actBipolar (signed short aValue)
Bipolar (centered) control. Input range -1000..1000. Output: pulse width mapped to kMinPulse..kMaxPulse with center at mid-point.
void actUnipolar (signed short aValue)
Unipolar (absolute) control. Input range 0..1000. Output: pulse width mapped to kMinPulse..kMaxPulse.

Detailed Description

This driver implements servo control without using the hardware PWM limitations of the Arduino Servo library. Each instance manages its own timing and inherits from Tickable to integrate with the event loop.

Template parameters:

  • kPin Servo signal pin number.
  • kMinPulse Minimum pulse width in microseconds (default: 1000)
  • kMiddlePulse Middle pulse width in microseconds (default: 1500)
  • kMaxPulse Maximum pulse width in microseconds (default: 2000)

Public Functions Documentation

function GetPin

Get the servo pin number.

inline int evam::SoftwareServoDriver::GetPin () const

Returns:

Pin number used for servo signal.


function SoftwareServoDriver [1/2]

Constructor. Initializes the pin as output.

inline evam::SoftwareServoDriver::SoftwareServoDriver () 

function SoftwareServoDriver [2/2]

template<typename... Args>
inline evam::SoftwareServoDriver::SoftwareServoDriver (
    SoftwareServoConfig config,
    Args... args
) 

Protected Functions Documentation

function actBipolar

Bipolar (centered) control. Input range -1000..1000. Output: pulse width mapped to kMinPulse..kMaxPulse with center at mid-point.

inline void evam::SoftwareServoDriver::actBipolar (
    signed short aValue
) 

Parameters:

  • aValue Input value, range -1000..1000.

function actUnipolar

Unipolar (absolute) control. Input range 0..1000. Output: pulse width mapped to kMinPulse..kMaxPulse.

inline void evam::SoftwareServoDriver::actUnipolar (
    signed short aValue
) 

Parameters:

  • aValue Input value, range 0..1000.


The documentation for this class was generated from the following file src/evamSoftwareServoDriver.h