Error when declaring the pins for an LCD screen

Hi
I am super new to Arduino and I am trying to make a program with an LCD screen using an Arduino Micro.
My LCD I am using seems to be a simpiler kind to the ones used in tutorials I have seen, it only has 4 pins, one for GND, one for VCC and SDA and SCL which I have plugged into pins 5 and 6.
This is the code I am using

#include <LiquidCrystal.h>
LiquidCrystal lcd(6, 5);

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

void loop() {
  lcd.setCursor(0,0);          
  lcd.print("Hello!"); 
}

When I compile this I get the following error

Arduino: 1.8.13 (Windows 10), Board: "Arduino Micro"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\samue\OneDrive\Documents\Arduino\libraries -fqbn=arduino:avr:micro -ide-version=10813 -build-path C:\Users\samue\AppData\Local\Temp\arduino_build_46715 -warnings=none -build-cache C:\Users\samue\AppData\Local\Temp\arduino_cache_408832 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\SlAM Studios\Arduino\Water Timer\Test\Test.ino

C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\samue\OneDrive\Documents\Arduino\libraries -fqbn=arduino:avr:micro -ide-version=10813 -build-path C:\Users\samue\AppData\Local\Temp\arduino_build_46715 -warnings=none -build-cache C:\Users\samue\AppData\Local\Temp\arduino_cache_408832 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\SlAM Studios\Arduino\Water Timer\Test\Test.ino

Using board 'micro' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr

Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr

Detecting libraries used...

"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8037 "-DUSB_MANUFACTURER="Unknown"" "-DUSB_PRODUCT="Arduino Micro"" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "C:\Users\samue\AppData\Local\Temp\arduino_build_46715\sketch\Test.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Alternatives for LiquidCrystal.h: [LiquidCrystal@1.0.7]

ResolveLibrary(LiquidCrystal.h)

-> candidates: [LiquidCrystal@1.0.7]

"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8037 "-DUSB_MANUFACTURER="Unknown"" "-DUSB_PRODUCT="Arduino Micro"" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "C:\Users\samue\AppData\Local\Temp\arduino_build_46715\sketch\Test.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8037 "-DUSB_MANUFACTURER="Unknown"" "-DUSB_PRODUCT="Arduino Micro"" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src\LiquidCrystal.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Generating function prototypes...

"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8037 "-DUSB_MANUFACTURER="Unknown"" "-DUSB_PRODUCT="Arduino Micro"" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "C:\Users\samue\AppData\Local\Temp\arduino_build_46715\sketch\Test.ino.cpp" -o "C:\Users\samue\AppData\Local\Temp\arduino_build_46715\preproc\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE

"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\samue\AppData\Local\Temp\arduino_build_46715\preproc\ctags_target_for_gcc_minus_e.cpp"

Compiling sketch...

"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8037 "-DUSB_MANUFACTURER="Unknown"" "-DUSB_PRODUCT="Arduino Micro"" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "C:\Users\samue\AppData\Local\Temp\arduino_build_46715\sketch\Test.ino.cpp" -o "C:\Users\samue\AppData\Local\Temp\arduino_build_46715\sketch\Test.ino.cpp.o"

Test:2:23: error: no matching function for call to 'LiquidCrystal::LiquidCrystal(int, int)'

LiquidCrystal lcd(6, 5);

                   ^

In file included from C:\SlAM Studios\Arduino\Water Timer\Test\Test.ino:1:0:

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:55:3: note: candidate: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)

LiquidCrystal(uint8_t rs, uint8_t enable,

^~~~~~~~~~~~~

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:55:3: note: candidate expects 6 arguments, 2 provided

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:53:3: note: candidate: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)

LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,

^~~~~~~~~~~~~

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:53:3: note: candidate expects 7 arguments, 2 provided

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:50:3: note: candidate: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)

LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,

^~~~~~~~~~~~~

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:50:3: note: candidate expects 11 arguments, 2 provided

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:47:3: note: candidate: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)

LiquidCrystal(uint8_t rs, uint8_t enable,

^~~~~~~~~~~~~

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:47:3: note: candidate expects 10 arguments, 2 provided

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:45:7: note: candidate: constexpr LiquidCrystal::LiquidCrystal(const LiquidCrystal&)

class LiquidCrystal : public Print {

   ^~~~~~~~~~~~~

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:45:7: note: candidate expects 1 argument, 2 provided

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:45:7: note: candidate: constexpr LiquidCrystal::LiquidCrystal(LiquidCrystal&&)

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:45:7: note: candidate expects 1 argument, 2 provided

Using library LiquidCrystal at version 1.0.7 in folder: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal

exit status 1

no matching function for call to 'LiquidCrystal::LiquidCrystal(int, int)'

I am hoping this is a simple solution, either SCL and SDA are plugged in the wrong place or "LiquidCrystal lcd(6, 5);" is not the right way to assign the LCDs pins. Can someone please tell me what I need to change?

A4 and A5.

I did not wire begin nor a #include <Wire.h> statement.
#include <Wire.h> // Add the wire Library
#include <LiquidCrystal_I2C.h> // We need this library for the LCD

You will do yourself a favor if you install and use the hd44780 library for your I2C LCD. For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.

To install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.

The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.

In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.

Arduino: 1.8.13 (Windows 10), Board: "Arduino Micro"

On the Micro the pins for I2C are pin shown on this pinout diagram.

Thanks for the reply. I have changed the second line to

LiquidCrystal lcd(A2, A3);

(My Arduino only goes up to A3)
And I get the error

no matching function for call to 'LiquidCrystal_I2C::LiquidCrystal_I2C(const uint8_t&, const uint8_t&)'

What can I do about this?

A4 and A5 i.e. SDA and SCL was for Arduino UNO.

Which Arduino do you have.

I have Arduino Micro (I will add this to the main post)

Thank make it say

LiquidCrystal_I2C lcd (2, 3);

You also need to use LiquidCrystal_I2C.h

Sorry, I thought you had an UNO.

Maybe a Micro owner can help you.

What he is asking is fairly simple. But he is using the wrong library

I have change the code to

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(A2, A3);

But I get the same error

Try this

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

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup()
{
  lcd.init();
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("      Hello       ");
  lcd.setCursor(0, 1);
  lcd.print(" Hope this helped ");

}


void loop()
{
}
1 Like

Make sure you install Wire.h (it should already be there But I am making sure)
And LiquidCrystal_I2C

@slam113, you're topic has been moved to a more suitable location on the forum.

Out of curiosity, why do you think that this was related to Avrdude, stk500, Bootloader issues ? If we can understand that, it might be easier for us to improve the forum.

Are those tags on my post? I do not know where those came from, I did not set them

Did you try my code?

This complies and runs without errors so thanks for that. When it runs nothing is shown on the LCD. Do I need to tell it what pins are used or something?

No, Let me look at my code ril quick

is it wired up correctly?