Struct ServoMap
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
MinUsushortThe pulse width at zero degrees, in microseconds.
MaxUsushortThe pulse width at full travel, in microseconds.
RangeDegfloatThe 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
MinUs
The pulse width at zero degrees, in microseconds.
public ushort MinUs { get; init; }
Property Value
RangeDeg
The full travel in degrees; its magnitude is used.
public float RangeDeg { get; init; }
Property Value
Standard
Gets the standard hobby servo: 1000 to 2000 microseconds over 180 degrees.
public static ServoMap Standard { get; }
Property Value
Methods
Angle(ushort)
Returns the angle a pulse width sets.
public float Angle(ushort pulseUs)
Parameters
pulseUsushortThe 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
angleDegfloatThe 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.