HX711: no matching function call for

I have found many examples on line of how to use the HX711 loadcell amplifier. Almost all of them include the line of code "HX711 scale(dout,clk);".

Here is a short example from brainy-bits.com:

/* Calibration sketch for HX711 */

#include "HX711.h" // Library needed to communicate with HX711 GitHub - bogde/HX711: An Arduino library to interface the Avia Semiconductor HX711 24-Bit Analog-to-Digital Converter (ADC) for Weight Scales.

#define DOUT 7 // Arduino pin 7 connect to HX711 DOUT
#define CLK 6 // Arduino pin 6 connect to HX711 CLK

HX711 scale(DOUT, CLK); // Init of library

void setup() {
Serial.begin(9600);
scale.set_scale(); // Start scale
scale.tare(); // Reset scale to zero
}

void loop() {
float current_weight=scale.get_units(20); // get average of 20 scale readings
float scale_factor=(current_weight/0.145); // divide the result by a known weight
Serial.println(scale_factor); // Print the scale factor to use
}

If you try to compile this code you get the message "no matching functions for call to HX711::HX711(const int&, const int&, const int&)" for the line " HX711 scale(DOUT,CLK)".

Of course, the other examples I've tried yield the same error message. One post on this question recommended using HX711 scale(), but that not only does not work, but it also eliminates the link to the I/O pins.

Any suggestions as to what the problem is and how to correct it? Thank you.

rickir206:
One post on this question recommended using HX711 scale()

Close. It should be:

HX711 scale;

The library's API was changed since the time the examples you found were written:

rickir206:
but that not only does not work

Please provide a detailed description of what you mean by "does not work".

rickir206:
but it also eliminates the link to the I/O pins.

They are now defined via scale.begin().

rickir206:
Any suggestions as to what the problem is and how to correct it?

Any time you want to learn how to use a library, take a look at the examples you will find under File > Examples > {library name}. Unlike the sketches you will find at random places on the Internet, those examples are written specifically for the version of the library you have installed on your computer.

Karma: Thank you for your valuable advice. I knew something was out of date, I just could not figure out how the include file had changed. Your advice about looking the files:examples:hx711.h was spot on. I had used examples files in the past for sensors etc., but did not realize examples extended to include files. rickir206

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per