Loadcell System program error

Hello Divyansh here i needed a help as i am new to the arduino programing.
I am facing a problem in the code of arduino loadcell

The system says
no matching function for call to 'HX711::HX711(const uint8_t&, const uint8_t&)'

This is my code

/*  
  Arduino pin to HX711
  A2 ->  CLK
  A1 -> DAT
  5V -> VCC
  GND -> GND

  The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.
 */
#include <LiquidCrystal.h>
#include <HX711.h>

int button1 = 9;
int press1 = 0;

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

HX711 scale1(A1, A2);

#define MAXFLT 8 // 24 bit resolution is 7 digits

void setup() {
  lcd.clear();
  lcd.begin(16, 2);

  lcd.setCursor(0, 0);
  lcd.print(" Weighing Scale ");
  lcd.setCursor(0, 1);
  lcd.print("----MakerMan----");
  delay(3000);

  lcd.setCursor(0, 0);
  lcd.print("--Place Weight--");
  lcd.setCursor(0, 1);
  lcd.print("   ..... kg      ");

  scale1.set_scale(-11410);  // BUG: calibrate the scale (higher number, lower reading)
  scale1.tare();   // reset the scale to zero

  pinMode(button1, INPUT);
  digitalWrite(button1, HIGH); //enable pullups to make pin high

}

void loop() {
  float r;
  char buf[MAXFLT + 1];
  r = scale1.get_units(5); // average 10 readingslcd.print(scale1.get_units(10), 3); // average 10 readings
  Serial.println(dtostrf(r, MAXFLT, 3, buf));
  lcd.setCursor(0, 1);
  lcd.print(dtostrf(r, MAXFLT, 2, buf)); // average 10 readings, approx 1 second

  {
    press1 = digitalRead(button1);
    if (press1 == LOW)
    {
      scale1.tare();
    }
    else {
      /// do nothing
    }
  }
}

:upside_down_face:
Dot

Where did you get the HX711 library from and does it come with any examples ?

Compare how the HX711 object is declared in your code with how it is done in the examples

is this the 3rd (post)

@ divyanshsingh, you are apparently basing your code on an outdated example. The HX711.h library was updated back in back in March of 2019 and the constructor overload that took the pin numbers as arguments was removed. That information is now supplied via the class's begin() function. See the code examples that come with the library for details.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.