HX711 is a 24-bit A / D converter chip designed for high-precision electronic scales.
This example is suitable for HX711 sensor and read data through Arduino.
Product Link (https://www.dfrobot.com/product-2289.html)
KIT0176: I2C 1Kg Weight Sensor Kit - HX711
Provide an Arduino library to get weight by reading data from HX711.
To use this library, first download the library file, paste it into the \Arduino\libraries directory, then open the examples folder and run the demo in the folder.
/*!
* @fn begin
* @brief init function
* @return return 1 if initialization succeeds, otherwise return non-zero and error code.
*/
int begin(void);
/*!
* @fn readWeight
* @brief Get the weight of the object
* @param times Take the average several times
* @return return the read weight value, unit: g
*/
float readWeight(uint8_t times = 12);
/*!
* @fn getCalibration
* @brief get calibration value
* @return return the read calibration value
*/
float getCalibration();
/*!
* @fn setCalibration
* @brief Set calibration value
* @param value the calibration value
*/
void setCalibration(float value);
/*!
* @fn setThreshold
* @brief Set the trigger threshold when the weight sensor module is automatically calibrated(g)
* @param threshold threshold
*/
void setThreshold(uint16_t threshold);
/*!
* @fn setCalWeight
* @brief Set the calibration weight when the weight sensor module is automatically calibrated(g)
* @param triWeight Weight
*/
void setCalWeight(uint16_t triWeight);
/*!
* @fn enableCal
* @brief Start sensor calibration
*/
void enableCal();
/*!
* @fn peel
* @brief remove the peel
*/
void peel();
/*!
* @fn getCalFlag
* @brief Wait for sensor calibration to complete
* @return Result
* @retval true The calibration completed
* @retval false The calibration is not complete
*/
bool getCalFlag();
MCU | Work Well | Work Wrong | Untested | Remarks |
---|---|---|---|---|
Arduino uno | √ | |||
FireBeetle-ESP8266 | √ | |||
FireBeetle-ESP32 | √ | |||
mpython | √ | |||
microbit | √ |
- 2020/12/31 - Version 1.0.0 released.
Written by fengli(li.feng@dfrobot.com), 2020.12.31 (Welcome to our website)