Class Hx711
24-Bit Dual-Channel ADC For Bridge Sensors
Assembly: Hx711.dll
View Source
public class Hx711 : PollingSensorBase<Mass>, IObservable<IChangeResult<Mass>>, IMassSensor, ISamplingSensor<Mass>, ISensor<Mass>, ISensor, ISamplingSensor, IDisposable
Inheritance: System.Object
-> Meadow.Foundation.ObservableBase<UNIT> -> Meadow.Foundation.SamplingSensorBase<UNIT> -> Meadow.Foundation.PollingSensorBase<UNIT>
Implements:
System.IObservable<Meadow.IChangeResult<Meadow.Units.Mass>>
, Meadow.Peripherals.Sensors.Mass.IMassSensor
, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Mass>
, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Mass>
, Meadow.Peripherals.Sensors.ISensor
, Meadow.Peripherals.Sensors.ISamplingSensor
, System.IDisposable
Properties
IsDisposed
Is the peripheral disposed
View Source
public bool IsDisposed { get; }
IsSleeping
Is the peripheral sleeping
View Source
public bool IsSleeping { get; }
Gain
View Source
public Hx711.AdcGain Gain { get; }
TareValue
Gets/Sets Tare value
View Source
public uint TareValue { get; set; }
DefaultSamplePeriod
Gets default sample period (1 Second)
View Source
public TimeSpan DefaultSamplePeriod { get; }
Mass
The last read Mass
View Source
public Mass? Mass { get; }
Methods
Sleep()
Puts the device into low-power sleep mode
View Source
public void Sleep()
Wake()
Takes the device out of low-power sleep mode
View Source
public void Wake()
Tare()
Tares the sensor, effectively setting the current weight reading to relative zero.
View Source
public void Tare()
CalculateCalibrationFactor()
Calculates the calibration factor of the load cell. Call this method with a known weight on the sensor, and then use the returned value in a call to Meadow.Foundation.Sensors.LoadCell.Hx711.SetCalibrationFactor(System.Int32%2cMeadow.Units.Mass)
before using the sensor.
View Source
public int CalculateCalibrationFactor()
Returns
System.Int32
SetCalibrationFactor(int, Mass)
Sets the sensor's calibration factor based on a factor calculated with a know weight by calling Meadow.Foundation.Sensors.LoadCell.Hx711.CalculateCalibrationFactor().
View Source
public void SetCalibrationFactor(int factor, Mass knownValue)
Parameters
Type | Name |
---|---|
System.Int32 | factor |
Meadow.Units.Mass | knownValue |
ReadSensor()
Gets the current sensor weight
View Source
protected override Task<Mass> ReadSensor()
Returns
System.Threading.Tasks.Task<Meadow.Units.Mass>
Dispose(bool)
Dispose of the object
View Source
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Is disposing |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
View Source
public void Dispose()
Implements
System.IObservable<Meadow.IChangeResult<Meadow.Units.Mass>>
Meadow.Peripherals.Sensors.Mass.IMassSensor
Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Mass>
Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Mass>
Meadow.Peripherals.Sensors.ISensor
Meadow.Peripherals.Sensors.ISamplingSensor
System.IDisposable