Documentation ¶
Overview ¶
Package hx711 implements an interface to the HX711 analog to digital converter.
Datasheet ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // TimeoutError is returned from Read and ReadAveraged when the ADC took too // long to indicate data was available. TimeoutError = errors.New("timed out waiting for HX711 to become ready") )
Functions ¶
This section is empty.
Types ¶
type Dev ¶
type Dev struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new HX711 device. The data pin must support edge detection. If your pin doesn't natively support edge detection you can use PollEdge from periph.io/x/periph/experimental/conn/gpio/gpioutil
func (*Dev) Halt ¶
func (d *Dev) Halt()
Halt stops a continuous read that was started with StartContinuousRead. This will close the channel that was returned by StartContinuousRead.
func (*Dev) Read ¶
Read reads a single value from the ADC. It blocks until the ADC indicates there is data ready for retrieval. If the ADC doesn't pull its Data pin low to indicate there is data ready before the timeout is reached, TimeoutError is returned.
func (*Dev) SetInputMode ¶
SetInputMode changes the voltage gain and channel multiplexer mode.
func (*Dev) StartContinuousRead ¶
StartContinuousRead starts reading values continuously from the ADC. It returns a channel that you can use to receive these values.
You must call Halt to stop reading.
Calling StartContinuousRead again before Halt is an error, and nil will be returned.