upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | List of all members

API for the HX711 Analog-to-Digital Converter. More...

Detailed Description

HX711 is a precision 24-bit analog-to-digital converter (ADC) designed for weight scales and industrial control applications to interface directly with a bridge sensor. This module was tested on the Intel(R) Galileo Gen 2 board.

hx711.jpeg

Public Member Functions

synchronized void delete ()
 
 HX711 (short data, short sck, short gain)
 
 HX711 (short data, short sck)
 
long read ()
 
void setGain (short gain)
 
void setGain ()
 
long readAverage (short times)
 
long readAverage ()
 
double getValue (short times)
 
double getValue ()
 
float getUnits (short times)
 
float getUnits ()
 
void tare (short times)
 
void tare ()
 
void setScale (float scale)
 
void setScale ()
 

Constructor & Destructor Documentation

HX711 ( short  data,
short  sck,
short  gain 
)

HX711 constructor

Parameters
dataDefines the data pin
sckDefines the clock pin
gainDefines the gain factor Valid values are 128 or 64 for channel A; channel B works with a 32-gain factor only

Member Function Documentation

float getUnits ( short  times)

Returns getValue() divided by SCALE

Parameters
timesDefines how many readings to do
Returns
Raw value divided by a value obtained via calibration
double getValue ( short  times)

Returns (readAverage() - OFFSET)

Parameters
timesDefines how many readings to do
Returns
Current value without the tare weight
long read ( )

Waits for the chip to be ready and returns a reading

Returns
Raw ADC reading
long readAverage ( short  times)

Returns an average reading

Parameters
timesDefines how many reading to do
Returns
Average reading
void setGain ( short  gain)

Sets the gain factor; takes effect only after a call to read() channel A can be set for a 128 or 64 gain; channel B has a fixed 32-gain factor depending on the parameter; the channel is also set to either A or B

Parameters
gainDefines the gain factor
void setScale ( float  scale)

Sets the SCALE value This value is used to convert the raw data to human-readable data (measurement units)

Parameters
scaleValue obtained via calibration
void tare ( short  times)

Sets the OFFSET value for the tare weight

Parameters
timesDefines how many times to read the tare value

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