Documentation
¶
Index ¶
- Constants
- func CalculateCalibratedReading(rawValue int32, attribute *HX711Attributes) (float64, error)
- type HX711
- func (h *HX711) Calibrate(numberOfReadings int, knownWeight float64) error
- func (h *HX711) OnReady() error
- func (h *HX711) ReadCalibratedData() (float64, error)
- func (h *HX711) ReadData() (int32, error)
- func (h *HX711) Reset() error
- func (h *HX711) SetGain() error
- func (h *HX711) Sleep() error
- func (h *HX711) Tare(numberOfReadings int) (float64, error)
- type HX711Attributes
Constants ¶
View Source
const ( GAIN_A_128 = 1 GAIN_B_32 = 2 GAIN_A_64 = 3 )
Variables ¶
This section is empty.
Functions ¶
func CalculateCalibratedReading ¶
func CalculateCalibratedReading(rawValue int32, attribute *HX711Attributes) (float64, error)
CalculateCalibratedReading calculate the calibrated reading based on the raw value and tare/calibrated values
Types ¶
type HX711 ¶
type HX711 struct {
Clock string
Data string
Gain int
Attributes *HX711Attributes
// contains filtered or unexported fields
}
func NewWithKnownAttributes ¶
func NewWithKnownAttributes(data string, clock string, attributes *HX711Attributes) (*HX711, error)
New initializes a new object with the known calibration values
func (*HX711) ReadCalibratedData ¶
ReadCalibratedData get the values from the device and transform them per the known attributes
type HX711Attributes ¶
type HX711Attributes struct {
// Tare the reading at "zero"
Tare float64 `json:"tare"`
// CalibratedReading the raw reading from the device for the CalibratedWeight
CalibratedReading float64 `json:"calibratedReading"`
// CalibratedWeight the known weight when calibrating
CalibratedWeight float64 `json:"calibratedWeight"`
}
Click to show internal directories.
Click to hide internal directories.