Crate hx711_spi[−][src]
HX711 embedded-hal SPI driver crate
This is a platform agnostic driver to interface with the HX711 load cell IC. It uses SPI instad of bit banging.
This driver is built using embedded-hal
traits.
Usage
Use an embedded-hal implementation to get SPI. HX711 does not use CS and SCLK. Make sure that it is the only device on the bus. Connect the SDO to the PD_SCK and SDI to DOUT of the HX711. SPI clock frequency has to be between 20 kHz and 5 MHz.
use rppal::spi::{Spi, Bus, SlaveSelect, Mode}; use hx711_spi::{Hx711, HX711Mode}; let spi = Spi::new(Bus::Spi0, SlaveSelect::Ss0, 1_000_000, Mode::Mode0).unwrap(); // to create sensor with default configuration: let mut scale = Hx711(spi); // start measurements let mut value = scale.readout().unwrap();
References
Structs
Hx711 | Represents an instance of a HX711 device |
Enums
HX711Mode | The HX711 has two chanels: |