Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
Hx711 Class Reference

Nol.A library for digital weight scale based on HX711. More...

#include <HX711.hpp>

Public Member Functions

 Hx711 (uint8_t pin_din, uint8_t pin_slk)
 Bind the data-output pin (pin_din) and serial-clock pin (pin_slk).
void begin ()
 Configure GPIO, zero using 32 samples, and set the default scale of 742.
int32_t getMilligram ()
 Return one calibrated sample in milligrams using (raw - offset) * 1000 / scale.
int32_t getAveragedMilligram (uint8_t times=32)
 Return an averaged calibrated reading in milligrams.
void setOffset (int32_t offset)
 Set the raw ADC count subtracted before scaling.
int32_t getOffset ()
 Return the current zero-load offset in raw ADC counts.
void setScale (int32_t scale=742)
 Set the calibration divisor in ADC counts per gram.
int32_t getScale ()
 Return the current calibration divisor in ADC counts per gram.
void adjustZero ()
 Average 32 raw samples and store the result as the zero-load offset.

Detailed Description

Nol.A library for digital weight scale based on HX711.

Author
Jongsoo Jeong (CoXlab)
Date
2016. 7. 8.
Note
This code is implemented based on Weihong Guan's Arduino library (https://github.com/aguegu/Arduino).

Blocking HX711 load-cell reader with offset and scale calibration. Reads wait indefinitely for data-ready. Call begin() with the scale unloaded.

Examples
st-nucleo-l152re/HX711-Scale/main.cpp.

Member Function Documentation

◆ getAveragedMilligram()

int32_t Hx711::getAveragedMilligram ( uint8_t times = 32)

Return an averaged calibrated reading in milligrams.

Parameters
timesNumber of raw samples to average; must be greater than zero.

◆ setOffset()

void Hx711::setOffset ( int32_t offset)

Set the raw ADC count subtracted before scaling.

Parameters
offsetZero-load ADC offset.

◆ setScale()

void Hx711::setScale ( int32_t scale = 742)

Set the calibration divisor in ADC counts per gram.

Parameters
scaleNonzero divisor, default 742; the driver does not validate it.

The documentation for this class was generated from the following file: