SparkFun Forums 

Where electronics enthusiasts find answers.

#206614
Hello.

I'm just gonna get straight to it.

My hardware is not the issue right now, not the wiring or anything, just the code. I know this because I'm not even trying to upload to the board, just verifying the sketch causes the problem.

I followed this great tutorial: https://learn.sparkfun.com/tutorials/lo ... d-examples

I'm up to the coding part and after installing the correct library for HX711, I copied and pasted the code into IDE. Every single time I try to verify the code, no matter what I do, it gives me the same error: no matching function for call to 'HX711::HX711()'

I can post the full error message if that helps.

Any help would be greatly appreciated as this is a project that has an upcoming deadline and I'm stuck. Please help.
Thank you!
You do not have the required permissions to view the files attached to this post.
#206647
Hi Josh,

I'm not able to re-create your error here so I think the issue may be related to how the library was installed. How did you install the library and which library are you installing? Make sure you install the "HX711 Arduino Library" by Bogdan Necula and Andreas Motl.

If that does not fix the issue, it may be related to using the Windows App version of the IDE versus the installer/executable or .zip downloads. In my testing, I am using v1.8.9 downloaded and installed by selecting the "Windows Installer" option from the Arduino downloads page so if, after checking the library is correct and properly installed and it does not work, try downloading and running the Installer tool.
#206848
Alright,

So I downloaded it from their website and it solved the problem for the HX711Serial example from the library.

That being said, the problem persists for the calibration code provided by Sparkfun. I still have this error: SparkFun_HX711_Calibration:41:7: error: no matching function for call to 'HX711::HX711()'

Being the ameteur coder I am, I simply removed the problematic parts of the Sparkfun code and replaced those parts with the working parts from the HX711Serial example code. That gave me this:

#include "HX711.h"

// HX711.DOUT - pin #A1
// HX711.PD_SCK - pin #A0

HX711 scale(A1, A0); // parameter "gain" is ommited; the default value 128 is used by the library

float calibration_factor = -7050; //-7050 worked for my 440lb max scale setup

void setup() {
Serial.begin(9600);
Serial.println("HX711 calibration sketch");
Serial.println("Remove all weight from scale");
Serial.println("After readings begin, place known weight on scale");
Serial.println("Press + or a to increase calibration factor");
Serial.println("Press - or z to decrease calibration factor");



long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
}

void loop() {

scale.set_scale(calibration_factor); //Adjust to this calibration factor

Serial.print("Reading: ");
Serial.print(scale.get_units(), 1);
Serial.print(" lbs"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();

if(Serial.available())
{
char temp = Serial.read();
if(temp == '+' || temp == 'a')
calibration_factor += 10;
else if(temp == '-' || temp == 'z')
calibration_factor -= 10;
}
}

As far as I can tell, it works. I still have to calibrate it but it gives me actual readings. Could you please compare this code above with the original Sparkfun calibration code to see what I did and if my changes messed things up? Thank you.
You do not have the required permissions to view the files attached to this post.
#206895
Hi again Josh,

I think I may have figured out where that error is coming from. The HX711 Serial example is not what our example code is based on. I was poking around trying to find the "HX711Serial" example and noticed it was in a separate library called "HX711 Master", not "HX711 Arduino Library". It looks like somehow a second HX711 master was installed and is most likely installed in your Libraries folder that may be conflicting with the call for the HX711 header file in the SparkFun example.

What I did to find the other library and delete it was first, open the "HX711Serial" example and then either use the shortcut (CTRL+K) or open the Sketch menu and select "Show Sketch Folder". That will open the folder where that example is saved and you should be able to go to the HX711 Master folder from there. Remove that from your Arduino/Libraries folder (either delete it or if you want to save it, just move it to your desktop or another file path). Double-check in your Libraries folder that the "HX711 Arduino Library" is still present and then restart Arduino.

After that, retry the SparkFun Examples and see if you still get the error. Let me know if you're still having trouble after that and we can keep digging.