Good afternoon Ladies and Gentlemen,
For my high school Senior project in my Biomedical Engineering class, one of the steps for my final product is creating a weight sensor that allows me to see the weight measured on a LCD screen. I was able to find this beautifully laid out in the article *Digital Force Gauge & Weight Scale with Loadcell & Arduino * and under "Measuring the Weight of Objects" I was able to find the breadboard view of the wiring and the code.
However, when I used the code:
/*
* Digital Weighing Scale with Load Cell
* by Hanie kiani
* https://electropeak.com/learn/
*/
#include "HX711.h" //You must have this library in your arduino library folder
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
#define DOUT 4
#define CLK 5
HX711 scale(DOUT, CLK);
float calibration_factor = 2230; // this calibration factor is adjusted according to my load cell
float units;
void setup() {
lcd.begin(16,2);
Serial.begin(9600);
Serial.println("Press T to tare");
scale.set_scale(calibration_factor); //Adjust to this calibration factor
scale.tare();
}
void loop() {
units = scale.get_units(), 5;
if (units < 0)
{
units = 0.00;
}
lcd.setCursor(0,0);
lcd.print("Weight: ");
lcd.setCursor(8,0);
lcd.print(units,5); //displays the weight in 4 decimal places only for calibration
lcd.setCursor(14,0);
lcd.print("grams");
if(Serial.available())
{
char temp = Serial.read();
if(temp == 't' || temp == 'T')
scale.tare(); //Reset the scale to zero
}
}
I got the error:
<Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "Arduino Uno"
Weight_sensor_project:11:22: error: no matching function for call to 'HX711::HX711(int, int)'
HX711 scale(DOUT, CLK);
^
In file included from C:\Users\311rwv26\Documents\Arduino\Weight_sensor_project\Weight_sensor_project.ino:6:0:
C:\Users\311rwv26\Documents\Arduino\libraries\HX711\src/HX711.h:30:3: note: candidate: HX711::HX711()
HX711();
^~~~~
C:\Users\311rwv26\Documents\Arduino\libraries\HX711\src/HX711.h:30:3: note: candidate expects 0 arguments, 2 provided
C:\Users\311rwv26\Documents\Arduino\libraries\HX711\src/HX711.h:19:7: note: candidate: constexpr HX711::HX711(const HX711&)
class HX711
^~~~~
C:\Users\311rwv26\Documents\Arduino\libraries\HX711\src/HX711.h:19:7: note: candidate expects 1 argument, 2 provided
exit status 1
no matching function for call to 'HX711::HX711(int, int)'>
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
(I apologize and please forgive me if I formatted the code and/or the error incorrectly. This is my first time posting a question, and even after reading the How to get the best out of this forum (full version) article, it is possible that I still formatted incorrectly)
I found how to fix the code in the comments of the above mentioned article, but I was confused and was hoping for some help.
Thank you for all your help!