Arduino UNO Programming Question

Hello,

Few days ago i just get an Arduino UNO, for a small project.
It's my first time when i use that board, i have no programming experience.
My project its like that:
I have one board Arduino UNO
One Moisture sensor
One 5v Relay for Arduino
And a LCD
5v Mini water pump

I find that code and i use it, it works

const int VAL_PROBE = 0; //Analog pin 0
const int MOISTURE_LEVEL = 250; // the value after the LED goes on

void setup()
{
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  pinMode(7, OUTPUT);
}

void LedState(int state)
{
  digitalWrite(13,state);
}

void loop()
{
  int moisture = analogRead(VAL_PROBE);
  
  Serial.print("Moisture = ");
  Serial.println(moisture);
  
  if(moisture > MOISTURE_LEVEL)
  {
    LedState(HIGH);
    digitalWrite(7,LOW);
  }
  else 
  {
    LedState(LOW);
    digitalWrite(7,HIGH);
  }
  
  delay(500);
}

But i want to use that LCD Display too, i really need a code to show:
Soil Moisture : %
Last Watered : Date/Time
I'm asking you guys because its something new for me, and i need that a bit fast.. i started since yesterday to learn Arduino by myself..
Thanks all.

Here you go:

Just replace lcd.print("Hello World") with

lcd.print("Soil Moisture: ");
        lcd.print(moisture);

and so on....

I'm using LCD with I2C adaptor, wires are GND VCC SCL SDA, i have to put on the same pins on arduino board too, that SCL SDA , i know gnd/vcc its for power.

Arduino has a dedicated library to allow you communicate with I2C devices :wink:

Get it, but i have no clue how to combine LCD with my sensor->relay code..

I change my code with

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

#define I2C_ADDR    0x27 // <<----- Add your address here.  Find it from I2C Scanner
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

int n = 1;

LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
 int potPin = A0; //input pin
int soil=250;
void setup() {
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home
 lcd.begin(16, 2);
 // lcd rows and columns
 lcd.print("Humidity");
// title of sorts
Serial.begin(9600);
}
void loop() {
// map the values
 int soil = analogRead(potPin) ;
 soil = constrain(soil, 485, 1023);
 soil = map(soil, 485, 1023, 100, 0);
 lcd.setCursor(0, 1);
 //display final numbers
 lcd.print(soil);
 //print the percent symbol at the end
 lcd.print("%");
//wait 0.1 seconds
 delay(75);
//wipe the extra characters
 lcd.print(" ");
 delay(1);
}

That works, sensor works and on lcd it show me, humidity
But my water pump relay its removed and i don't know how to put it and : Last watered message on LCD..