Stuck with arduino scales HX711, load cell 0-100g, lcd 16x2 I2C

Hi, could someone help me. I am stuck with a code. when I am uploading it to arduino Nano. error message pops (error compiling for Arduino Nano)

^

#include <LiquidCrystal_I2C.h>
#include <Wire.h>


LiquidCrystal_I2C lcd(0x27,16,2);

#include <HX711.h>

HX711 scale(A1, A0);

long Rohvert;
long offset = -115920;
float Scale = 6647.4;
float Masse;

const int buttonPin = 2;
int ButtonState = 0;


void setup()
{
  Serial.begin(115200);
  scale.set_gain(128);
  pinMode(ButtonPin, INPUT);

  lcd.init();

lcd.backlight();
lcd.setCursor(4,0);
lcd.print("mg");

delay(3000);

lcd.setCursor(4,0);
lcd.print("        ");
lcd.setCursor(0,0);
lcd.print("= -");
}
void loop()
{ buttonState = digitalRead(buttonPin);

if (ButtonState == HIGH)
{
  scale.read_average(20);
  offset = scale.read_average(20);
}

scale.read_average(20);
Rohvert = scale.read_average(20);

Masse = (Rohvert - offset) / Scale;

Serial.print("Masse = ");
Serial.println(Masse, 2);

lcd.setCursor(4,0);
lcd.print("          ");
lcd.setCursor(4,0);
lcd.print(Masse,2);
lcd.print(" g");

delay(50);
}

The error should show a lot more. When a compile error occurs, a "copy error messages" is shown at the right hand side just above the output window.

Paste the complete error message here.

Why do you call scale.read_average() once and throw the result away, and then call it again and save the result, in two places?

so i get this error: Arduino: 1.8.5 (Windows 7), Board: “Arduino Nano, ATmega328P”

D:\Dokumentai\Arduino\libraries\Liquidcrystal\I2CIO.cpp:35:26: fatal error: …/Wire/Wire.h: No such file or directory

#include <…/Wire/Wire.h>

^

compilation terminated.

Multiple libraries were found for “LiquidCrystal_I2C.h”
Used: D:\Dokumentai\Arduino\libraries\Liquidcrystal
Not used: D:\Dokumentai\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
Not used: D:\Dokumentai\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
Not used: D:\Dokumentai\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
Not used: D:\Dokumentai\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
exit status 1
Error compiling for board Arduino Nano.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

You are using a very old version of the LiquidCrystal library. Time for an upgrade.

And now I am getting this error :smiley:
svarstykles:31: error: within this context

lcd.init();

aivarr:
And now I am getting this error :smiley:
svarstykles:31: error: within this context

lcd.init();

Do NOT try to paraphrase the compiler output. Post the EXACT output from the IDE.

so I am attaching full error

error.txt (17.8 KB)

Where did you get the library that is throwing all those errors? Is it meant for use with a Nano? Or any Arduino, for that matter?

There IS a LiquidCrystal library that ships with the IDE. Try using that one...

so could someone could post a link with good lcd I2C library ? :smiley:

because I am still stuck with that error :smiley:

You appear to have fm's newLiquidCrystal library installed but are attempting to use the LiquidCrystal_I2C class incorrect by using it the way it is used for the LiquidCrystal_I2C library.
While both libraries contain a class called LiquidCrystal_I2C they are totally different libraries and work differently.

aivarr:
so could someone could post a link with good lcd I2C library ? :smiley:

It is available in the IDE library manager and can be installed directly from the IDE GUI.
The i/o class for an i2c backpack is hd44780_I2Cexp
There is lots of information about the library, how to install it, how to use it, and where to find the examples on the github page, its wiki, and in the included Documentation sketch that is included in the library.
The first thing you will want to do (after you have read the information and installed the library) is to run the included I2CexpDiag sketch to verify that the library and and the LCD device is working correctly.

--- bill

aivarr:
so i get this error: Arduino: 1.8.5 (Windows 7), Board: “Arduino Nano, ATmega328P”

D:\Dokumentai\Arduino\libraries\Liquidcrystal\I2CIO.cpp:35:26: fatal error: …/Wire/Wire.h: No such file or directory

#include <…/Wire/Wire.h>

^

compilation terminated.

Multiple libraries were found for “LiquidCrystal_I2C.h”
Used: D:\Dokumentai\Arduino\libraries\Liquidcrystal
Not used: D:\Dokumentai\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
Not used: D:\Dokumentai\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
Not used: D:\Dokumentai\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
Not used: D:\Dokumentai\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
exit status 1
Error compiling for board Arduino Nano.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Install Library /Wire.h: No such file or directory

https://www.9arduino.com/b/8

arduino