Basic: This code is not working

Using this code, ...

#include <Wire.h>   //i2c interface
#include <LiquidCrystal_I2C.h>; 
LiquidCrystal_I2C lcd(0x27,16,2);

void setup() {
lcd.init(0,0));
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Welcome, Blah, Blah Blah");
lcd.setCursor(0,1);
lcd.print("to the 16x2 LCD Screen");
}

void loop() {
  // put your main code here, to run repeatedly:
lcd.setCursor(16,2);
lcd.autoscroll();
lcd.println(" ");
delay(700);
}

I get...

WARNING: library LiquidCrystal I2C claims to run on avr architecture(s) and may be incompatible with your current board which runs on esp8266 architecture(s).
C:\Users\DELL\Documents\Arduino\_led_16x21_sketch_jul21a\_led_16x21_sketch_jul21a.ino: In function 'void setup()':
C:\Users\DELL\Documents\Arduino\_led_16x21_sketch_jul21a\_led_16x21_sketch_jul21a.ino:6:13: error: no matching function for call to 'LiquidCrystal_I2C::init(int, int)'
    6 | lcd.init(0,0));
      |             ^
In file included from C:\Users\DELL\Documents\Arduino\_led_16x21_sketch_jul21a\_led_16x21_sketch_jul21a.ino:2:
C:\Users\DELL\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:87:8: note: candidate: 'void LiquidCrystal_I2C::init()'
   87 |   void init();
      |        ^~~~
C:\Users\DELL\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:87:8: note:   candidate expects 0 arguments, 2 provided
Multiple libraries were found for "LiquidCrystal_I2C.h"
  Used: C:\Users\DELL\Documents\Arduino\libraries\LiquidCrystal_I2C
  Not used: C:\Users\DELL\Documents\Arduino\libraries\LiquidCrystal_I2C-master
exit status 1

Compilation error: no matching function for call to 'LiquidCrystal_I2C::init(int, int)'
lcd.init(0,0));

Leaving aside the wrong number of brackets, what are the 2 parameters to this function ?

I suspect that the code you are using was not written for the library you are using

1 Like

When you install a library, look at the examples. They should be your guide line for your own code.

There are a millionLiquidCrystal_I2C libraries; which one did you install?

1 Like

I don't know, I struggle with coding (understatement)

I just went to ''include library'' and installed the 1st. one that matched exactly.

The compiler is giving you lots of helpful messages.
The simplest approach is to start with the first message, and work your way down.`

And then there is

As others have pointed out, look for the correct number of parameters, best done by looking at an example in your version of the library
`

1 Like

How do I do that? tried right click...

It will depend on where your library is located.
If it is on github, there will usually be a folder called examples.

Even easier in the Arduino IDE:
File/Examples
There will be examples from Built in and Custom libraries

1 Like

The very first warning is a big red flag that should grab your attention:

WARNING: library LiquidCrystal I2C claims to run on avr architecture(s) and may be incompatible with your current board which runs on esp8266 architecture(s).

1 Like

Did you install it using the Library Manager?

Yes.
Thanks to everybody for the help, but I think I will just give up on LCD Screens.

Remove the semicolon.

What Arduino controller are you using?

Tom... :smiley: :+1: :coffee: :australia:
PS. Should have been the first question.

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