V1/Toolbox.NETMF.Hardware.Port/DynamoEncoder.cs
/// <summary>
/// The sampler of the analog input
/// </summary>
The sampler of the analog input
The sampler of the analog input
private void Sampler()
        {
            int level = this._input.Read();
            this._steadyLevel = 0.9f * this._steadyLevel + 0.1f * level;
            if (--this._steadyDelay <= 0)
            {
                float delta = (level - this._steadyLevel) / OuterThreshold;
                if (delta > 1.0f ||
                    delta < -1.0f)
                {
                    this.Value = (int)(this.Value + delta);
                }
            }
        }
private void Sampler ( ) { int level = this . _input . Read ( ) ; this . _steadyLevel = 0.9f * this . _steadyLevel + 0.1f * level ; if ( -- this . _steadyDelay <= 0 ) { float delta = ( level - this . _steadyLevel ) / OuterThreshold ; if ( delta > 1.0f || delta < - 1.0f ) { this . Value = ( int ) ( this . Value + delta ) ; } } }
The sampler of the analog input
The sampler of the analog input
//read the current analog input //adjust the steady level //calculates the relative delta between the read //and the steady level //adjust the public value