Documentation
¶
Index ¶
- Constants
- type DT
- type Device
- func (d *Device) Calibrate(weightInGrams float64) (float64, error)
- func (d *Device) GetCalibrationFactor() float64
- func (d *Device) Read() int64
- func (d *Device) ReadCalibrated() int64
- func (d *Device) SetCalibrationFactor(factor float64)
- func (d *Device) SetGainAndChannel(g gainLVL)
- func (d *Device) Tare()
- func (d *Device) Zero()
- type SCK
Constants ¶
const ( Gain128 gainLVL = 1 // channel A, gain factor 128 Gain64 gainLVL = 2 // channel A, gain factor 64 Gain32 gainLVL = 3 // channel B, gain factor 32 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DT ¶
type DT interface {
Get() bool
}
DT represents a pin set as in, this is satisfied by a machine.D# pin definition in tinyGo before using you should invoke machine.D#.Configure(machine.PinConfig{Mode: machine.PinInputPullup}) CPP code indicates this is not safe in some Espressif boards and you should use machine.PinInputPulldown instead.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device represents a hx711 with a load cell hooked. I recommend that you power off between flashes if you use this device as reset causes weird states.
func New ¶
New returns a device configured and initialized with the passed ports if the device is not appropriately connected this might hang
func (*Device) Calibrate ¶
Calibrate takes the known correct weight of the current load and calculates a factor to correct for drift. It is recommended that you save this value once and set it on each ue of a new Device instance for a given hardware to avoid having to perform the calibration again. Performing this process with various weights improves accuracy.... supposedly, depends on the quality of the cell.
func (*Device) GetCalibrationFactor ¶
GetCalibrationFactor returns the factor by which results are multiplied to fine tune weight.
func (*Device) Read ¶
Read performs avg of <SmoothingFactor> reads and returns that, adjusted for offset and tare.
func (*Device) ReadCalibrated ¶ added in v0.1.2
ReadCalibrated performs avg of <SmoothingFactor> reads and returns that, adjusted for offset, tare and calibration. accuracy lost is intentional
func (*Device) SetCalibrationFactor ¶
SetCalibrationFactor sets a number by which reads will be multiplied to obtain a more accurate weight
func (*Device) SetGainAndChannel ¶
func (d *Device) SetGainAndChannel(g gainLVL)
func (*Device) Tare ¶
func (d *Device) Tare()
Tare performs ... well.. tare? https://en.wikipedia.org/wiki/Tare_weight