I’m trying to run several different examples of using an ESP32 with an LCD IC2 display and keep getting this error
In file included from src/main.cpp:4:
.pio/libdeps/lilygo-t-display/LiquidCrystal/LiquidCrystal_I2C.h:122:17: note: candidate: 'virtual void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t)'
virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
^~~~~
.pio/libdeps/lilygo-t-display/LiquidCrystal/LiquidCrystal_I2C.h:122:17: note: candidate expects 3 arguments, 0 provided
*** [.pio\build\lilygo-t-display\src\main.cpp.o] Error 1
I’ve tried including several different LiquidCrystal.h files but seem to get the same problem.
Any pointers would help
Do you really want to talk to an externally connected I2C LCD screen?
Or the on-board **1.14 inch ST7789V IPS LCD of the board?
Looks good but doesn’t solve my problem
Well you really didn’t answer my question.
In any case, if you really are wanting to talk to an external I2C LCD even though you have an on-board LCD (???) the lcd.begin()
function takes as said above the number of columns and rows, so e.g. lcd.begin(16, 2);
for 16x2 LCD.
You usually specify those paramters in the constructor though and just call the parameterless lcd.init()
.
See https://www.makerguides.com/character-i2c-lcd-arduino-tutorial/
#include "Wire.h" // Library for I2C communication
#include "LiquidCrystal_I2C.h" // Library for LCD
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2); // Change to (0x27,20,4) for 20x4 LCD.
void setup() {
// Initiate the LCD:
lcd.init();
lcd.backlight();
}
void loop() {
// Print 'Hello World!' on the first line of the LCD:
lcd.setCursor(2, 0); // Set the cursor on the third column and first row.
lcd.print("Hello World!"); // Print the string "Hello World!"
lcd.setCursor(2, 1); //Set the cursor on the third column and the second row (counting starts at 0!).
lcd.print("LCD tutorial");
}
Thanks, but the error is coming from the LCD header file (LIQUIDCRYSTAL_i2c.h) not my code.
Regards
Pete
Yes it comes from your code. Your src/main.cpp
calls the library.
In file included from src/main.cpp:4: