Table of Contents

Struct ServoMap

Namespace
Pamoja.Kit
Assembly
Pamoja.Kit.dll

A hobby servo's pulse widths across its travel.

public readonly record struct ServoMap : IEquatable<ServoMap>
Implements
Inherited Members

Constructors

ServoMap(ushort, ushort, float)

A hobby servo's pulse widths across its travel.

public ServoMap(ushort MinUs, ushort MaxUs, float RangeDeg)

Parameters

MinUs ushort

The pulse width at zero degrees, in microseconds.

MaxUs ushort

The pulse width at full travel, in microseconds.

RangeDeg float

The full travel in degrees; its magnitude is used.

Properties

MaxUs

The pulse width at full travel, in microseconds.

public ushort MaxUs { get; init; }

Property Value

ushort

MinUs

The pulse width at zero degrees, in microseconds.

public ushort MinUs { get; init; }

Property Value

ushort

RangeDeg

The full travel in degrees; its magnitude is used.

public float RangeDeg { get; init; }

Property Value

float

Standard

Gets the standard hobby servo: 1000 to 2000 microseconds over 180 degrees.

public static ServoMap Standard { get; }

Property Value

ServoMap

Methods

Angle(ushort)

Returns the angle a pulse width sets.

public float Angle(ushort pulseUs)

Parameters

pulseUs ushort

The pulse width in microseconds, held to the servo's range.

Returns

float

The angle in degrees, or 0 for a servo whose pulse range is empty.

Pulse(float)

Returns the pulse width that sets the servo to an angle.

public ushort Pulse(float angleDeg)

Parameters

angleDeg float

The angle in degrees, held to the servo's travel.

Returns

ushort

The pulse width in microseconds, or 0, no pulse, for an angle that is not a number.