HX711 Library 1.0.0
This is a library for the HX711 Module
|
#include <HX711-SOLDERED.h>
Inherits EasyC.
Public Member Functions | |
HX711 () | |
HX711 easyC constructor. | |
virtual | ~HX711 () |
HX711 default destructor. | |
HX711 (uint8_t pin_dout, uint8_t pin_sck) | |
HX711 native constructor. | |
void | waitUntilReady () |
Wait until the sensor is ready, this is a blocking function. | |
long | getRawReading () |
Get raw reading from the HX711. Works for both native and easyC. | |
long | getAveragedReading (uint8_t numReadings=1) |
Make a number of readings and get the average of them. | |
double | getOffsettedReading (uint8_t numReadings=1) |
Get an averaged reading minus the offset (set by setOffset) | |
double | getReadingInUnits (uint8_t numReadings=1) |
Get the reading in set units. See readInUnits.ino example for more info. | |
void | setZero () |
Set the 'Zero' value (offset) of the load cell, used for calibration. While calling this function, don't put any weight on the load cell! | |
void | setGain (uint8_t gain) |
Set the gain of the sensor. For both native and easyC. | |
float | getGain () |
Get the set gain value, in case you need it. | |
void | setScale (float scale) |
Set the scale applied to getReadingInUnits. See readInUnits.ino for more info! | |
float | getScale () |
Get the set scale value, in case you need it. | |
void | setOffset (float offset) |
Set the offset applied to getOffsettedReading. | |
float | getOffset () |
Get the set offset value, in case you need it. | |
void | setDeepSleep (bool sleep) |
Put the HX711 in deep sleep (turn it off). Works for both easyC and native. | |
Public Member Functions inherited from EasyC | |
EasyC () | |
Main constructor for easyC version. | |
void | begin () |
Initializes sensors on native or easyC on default address. | |
void | begin (uint8_t _address) |
Initializes sensors on supplied i2c address. | |
virtual void | initializeNative ()=0 |
int | sendAddress (char regAddr) |
Private function to send a single byte to sensor. | |
int | readData (char a[], int n) |
Private function to read n bytes over i2c. | |
int | readRegister (char regAddr, char a[], size_t n) |
Private function to send over i2c and then read n bytes. | |
int | sendData (const uint8_t *a, int n) |
Private function to write n bytes over i2c. | |
Protected Member Functions | |
void | initializeNative () |
HX711 native initialization. | |
Private Member Functions | |
uint8_t | readRegister () |
Read a data on the HX711 by pulsing the clock, used for getRawReading. | |
Private Attributes | |
int | _pin_dout |
int | _pin_sck |
uint8_t | _gain = GAIN_128 |
float | _scale = 1.0 |
float | _offset = 0.0 |
uint32_t | _zeroConstant = 0 |
Additional Inherited Members | |
Public Attributes inherited from EasyC | |
int | native = 0 |
bool | beginDone = 0 |
int | err |
char | address |
const char | defaultAddress = 0x30 |
HX711::HX711 | ( | ) |
HX711 easyC constructor.
|
virtual |
HX711 default destructor.
HX711::HX711 | ( | uint8_t | pin_dout, |
uint8_t | pin_sck | ||
) |
HX711 native constructor.
int | dout pin connected to hx711 dout pin |
int | pd_sck pin connected to hx711 pd_sck pin |
long HX711::getAveragedReading | ( | uint8_t | numReadings = 1 | ) |
Make a number of readings and get the average of them.
uint8_t | numReadings The number of readings to be done to average from |
float HX711::getGain | ( | ) |
Get the set gain value, in case you need it.
float HX711::getOffset | ( | ) |
Get the set offset value, in case you need it.
double HX711::getOffsettedReading | ( | uint8_t | numReadings = 1 | ) |
Get an averaged reading minus the offset (set by setOffset)
uint8_t | numReadings The number of readings to be done to average from |
long HX711::getRawReading | ( | ) |
Get raw reading from the HX711. Works for both native and easyC.
double HX711::getReadingInUnits | ( | uint8_t | numReadings = 1 | ) |
Get the reading in set units. See readInUnits.ino example for more info.
uint8_t | numReadings The number of readings to be done to average from |
float HX711::getScale | ( | ) |
Get the set scale value, in case you need it.
|
private |
void HX711::setDeepSleep | ( | bool | sleep | ) |
Put the HX711 in deep sleep (turn it off). Works for both easyC and native.
bool | sleep 'True' puts the device to sleep, 'False' turns it off. |
void HX711::setGain | ( | uint8_t | gain | ) |
Set the gain of the sensor. For both native and easyC.
uint8_t | gain Can either be GAIN_128, GAIN_64, GAIN_32 |
void HX711::setOffset | ( | float | offset | ) |
Set the offset applied to getOffsettedReading.
float | offset The offset to set |
void HX711::setScale | ( | float | scale | ) |
Set the scale applied to getReadingInUnits. See readInUnits.ino for more info!
float | scale The scale to set |
void HX711::setZero | ( | ) |
Set the 'Zero' value (offset) of the load cell, used for calibration. While calling this function, don't put any weight on the load cell!
void HX711::waitUntilReady | ( | ) |
Wait until the sensor is ready, this is a blocking function.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |