Skip to content

# Class evam::SoftwareServoDriver

template <int kPin, int kMinPulse, 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
--- | ---
| SoftwareServoDriver () Constructor. Initializes the pin as output.

## 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: 500)
- `kMaxPulse` Maximum pulse width in microseconds (default: 2500)

## Public Functions Documentation

### function SoftwareServoDriver

Constructor. Initializes the pin as output.

    inline evam::SoftwareServoDriver::SoftwareServoDriver ()

## 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`