No matching function for call to 'LiquidCrystal_I2C::begin(int, int)'

#define BLYNK_PRINT Serial
#include <Blynk.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <WiFiUdp.h>  // For OTA
#include <ArduinoOTA.h>  // For OTA
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>  // Library for LCD
#include <Wire.h>

#define ONE_WIRE_BUS 13
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

//#define I2C_SDA_PIN 21  // Using GPIO21 for SDA pin
//#define I2C_SCL_PIN 22  // Using GPIO22 for SCL pin
#define WATER_PUMP_PIN 12  // Replace 12 with the actual pin number you are using for the water pump relay
#define BLYNK_AUTH_TOKEN "94udGHGv3SN4_uGwYAsOMNiNbYbyMzuE"

#define moisture_sens 34  // Analog pin for soil moisture sensor

#define VPIN_SENS   V0  // Blynk virtual pin for soil moisture level
//#define LCD_ADDRESS 0x27  // I2C address for the LCD
//#define LCD_ROWS 2  // Number of rows on the LCD
//#define LCD_COLUMNS 16  // Number of columns on the LCD

char auth[] = "94udGHGv3SN4_uGwYAsOMNiNbYbyMzuE";  // Auth Token in the Blynk App
char ssid[] = "Redmi";  // WiFi SSID
char pass[] = "1234567890";  // WiFi password

LiquidCrystal_I2C lcd(0x27, 16, 2);

int sens1_value = 0;
int outputvalue1 = 0;
bool pumpRunning = false;
unsigned long pumpStartTime = 0;
const unsigned long pumpDuration = 3000;  // 3 seconds
const unsigned long pumpStopTime = 3000;  // 3 seconds

BlynkTimer timer;

void sendSensor()
  // Request temperature from all devices on the data line

  float tempC = sensors.getTempCByIndex(0);
  int moistureValue = analogRead(moisture_sens);
  int moistureLevel = map(moistureValue, 0, 4095, 100, 0);  // Reverse the mapping to get accurate moisture level

  Serial.print("Celsius temperature: ");
  Serial.print(" - Moisture Level: ");

  // Display temperature and moisture level on the LCD
  lcd.setCursor(0, 0);
  lcd.print("Temp: ");

  lcd.setCursor(0, 1);
  lcd.print("Moisture: ");

  // Send temperature and moisture level to Blynk
  Blynk.virtualWrite(V1, tempC);
  Blynk.virtualWrite(V2, moistureLevel);

void setup()
  // Debug console

  Wire.begin ( 21, 22); // Initialize the I2C interface with the chosen pins
  lcd.begin(16,2);  // Initialize the LCD display with the specified number of columns and rows

  pinMode(WATER_PUMP_PIN, OUTPUT);  // Set the water pump pin as an output

  Blynk.begin(auth, ssid, pass);
  ArduinoOTA.begin();  // For OTA
  timer.setInterval(100L, sendSensor);

void loop()
  ArduinoOTA.handle();  // For OTA;

  unsigned long currentMillis = millis();

  if (!pumpRunning && outputvalue1 < 66) {
    // Soil moisture level is low and pump is not running, start the pump
    pumpRunning = true;
    pumpStartTime = currentMillis;
    digitalWrite(WATER_PUMP_PIN, HIGH);
  } else if (pumpRunning && currentMillis - pumpStartTime >= pumpDuration) {
    // Pump has been running for the desired duration, stop the pump
    digitalWrite(WATER_PUMP_PIN, LOW);
    delay(pumpStopTime); // Wait for the specified stop time before checking moisture level
    pumpRunning = false;
  } else if (!pumpRunning && outputvalue1 >= 70) {
    // Soil moisture level is high and pump is not running, stop the pump
    digitalWrite(WATER_PUMP_PIN, LOW);

this is the code for my smart farming system project. Upon compiling the code, i got errors which says:
"Arduino: 1.8.19 (Windows 10), Board: “DOIT ESP32 DEVKIT V1, 80MHz, 921600, None, Disabled”

C:\Users\Aiman\Desktop\FYP\Coding\smart farming system 2\sketch_may06d\sketch_may06d.ino: In function ‘void setup()’:

sketch_may06d:88:17: error: no matching function for call to ‘LiquidCrystal_I2C::begin(int, int)’

lcd.begin(16,2); // Initialize the LCD display with the specified number of columns and rows


In file included from C:\Users\Aiman\Desktop\FYP\Coding\smart farming system 2\sketch_may06d\sketch_may06d.ino:10:

C:\Users\Aiman\Documents\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master/LiquidCrystal_I2C.h:76:7: note: candidate: ‘void LiquidCrystal_I2C::begin()’

void begin();


C:\Users\Aiman\Documents\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master/LiquidCrystal_I2C.h:76:7: note: candidate expects 0 arguments, 2 provided

exit status 1

no matching function for call to ‘LiquidCrystal_I2C::begin(int, int)’

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

can anyone help me to solve it?

When you post compiler error messages, serial output etc, you should use triple backticks at the beginning and end, the same way you do when posting code.

Clearly a syntax error with the command you’re using for the LCD library.
Presumably the code is designed for a different library to the one you’re using.

Not a Blynk related issue though.


thank youu