Arduino UNO + Straight Bar Load Cell (40 KG) + HX710B IC Based Weighing Scale - Using Arduino - Programming Questions - Arduino Forum
Arduino UNO + Straight Bar Load Cell (40 KG) + HX710B IC Based Weighing Scale - Using Arduino - Programming Questions - Arduino Forum
#define HX711_h
class HX711
{
private:
byte PD_SCK; // Power Down and Serial Clock Input Pin
byte DOUT; // Serial Data Output Pin
byte GAIN; // amplification factor
long OFFSET; // used for tare weight
float SCALE; // used to return weight in grams, kg, ounces, whatever
public:
// define clock and data pin, channel, and gain factor
// channel selection is made by passing the appropriate gain: 128 or 64 for channel A, 32 for channel B
// gain: 128 or 64 for channel A; channel B works with 32 gain factor only
HX711(byte dout, byte pd_sck, byte gain = 128);
virtual ~HX711();
// set 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
// depending on the parameter, the channel is also set to either A or B
void set_gain(byte gain = 128);
// returns (read_average() - OFFSET), that is the current value without the tare weight; times = how many
double get_value(byte times = 1);
// returns get_value() divided by SCALE, that is the raw value divided by a value obtained via calibration
// times = how many readings to do
float get_units(byte times = 1);
// set the OFFSET value for tare weight; times = how many times to read the tare value
void tare(byte times = 10);
// set the SCALE value; this value is used to convert the raw data to "human readable" data (measure units
void set_scale(float scale = 1.f);
// set OFFSET, the value that's subtracted from the actual reading (tare weight)
void set_offset(long offset = 0);
#endif /* HX711_h */