MD_HX711 Library 1.0
Library to interface HX711 Weigh Scales Module
Loading...
Searching...
No Matches
Using the Library

The library supports a polled and an interrupt driven approach to obtaining data from the HX711.

The enableInterruptMode() method is used by the application to toggle interrupt mode on/off as needed.

In all modes, the last received data is buffered in the library and retrieved using the getRaw(), getTared() and getCalibrated() methods, depending on what data is needed by the application.

Polled Mode

This is the default operating mode for the library.

In polled mode the read() method is invoked to read the next value from the hardware. If channel B is enabled the library will alternate reading channels (A, B, A, B, etc). The read() method always returns the id of the channel last processed.

As the read() method is blocking (it waits for the next data to be available read from the hardware) the isReady() method can be used to determine if
there is data ready for processing before calling read().

Interrupt Mode

Interrupt mode can be turned on and off as required using enableInterruptMode().

In interrupt mode the library will automatically process data received from the HX711 based on an interrupt generated by the device DAT signal going low. The application can monitor the getReadCount() method to determine when new data has been received.

For interrupt mode to work the I/O pin connected to the DAT signal must support external interrupts (eg, for an Arduino Uno this would be pins 2 or 3).