Class Debounce
Stops a flickering input from acting until it has settled.
public sealed class Debounce : IDisposable
- Inheritance
-
Debounce
- Implements
- Inherited Members
Remarks
A float switch or a contact bounces as it changes; requiring several agreeing readings keeps one bounce from starting a pump.
Constructors
Debounce(ushort, bool)
Creates a debouncer at the given settling length.
public Debounce(ushort samples, bool initial)
Parameters
samplesushortHow many agreeing readings are needed to change state.
initialboolThe state to start in.
Properties
State
Gets the settled state.
public bool State { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Update(bool)
Feeds a raw reading in and returns the settled state.
public bool Update(bool raw)
Parameters
rawboolThe latest unfiltered reading.
Returns
- bool
The debounced state.