Serial output in lcd.

On lcd nothing but serial monitor working fine.

#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
/*
0 - 232 rxd
1 - 232 txd
2 - rw (LCD) pin 4
3 - enable (LCD) pin 6
4 - sd card 9 (ETHERNET SHIELD)
5 - lcd d4 (LCD)
6 - lcd d5 (LCD)
7 - lcd d6 (LCD)
8 - lcd d7 (LCD)
9 - DS18B20
10 - w5100 select(ETHERNET SHIELD)
11 - SPI MOSI (ETHERNET SHIELD)
12 - SPI MISO (ETHERNET SHIELD)
13 - SPI CLK (ETHERNET SHIELD)

ANALOG
0 - MOISTURE in (analog) moisture_input 0
1 - moisture (digital) divider_top 2
2 - moisture 1 (digital) divider_bottom 3
3 - window open (digital)
4 - window close (digital)
5 - water pump (digital)

Moisture

Connect two nails and a resistor as shown

analog 1---* #define divider_top A1
|

/
\ R1
/
|
|
analog 0----* #define moisture_input A0
|
|
*----> nail 1

----> nail 2
|
|
|
analog 2---
#define divider_bottom A2

*/

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(2, 3, 5, 6, 7, 8);

// Data wire is plugged into pin 9 on the Arduino
#define ONE_WIRE_BUS 9

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// Arduino 1-Wire Address Finder

DeviceAddress insideThermometer = { 0x28, 0x2B, 0xE6, 0xDA, 0x02, 0x00, 0x00, 0x43 };
//DeviceAddress outsideThermometer = { 0x28, 0x6B, 0xDF, 0xDF, 0x02, 0x00, 0x00, 0xC0 };
//DeviceAddress groundThermometer = { 0x28, 0x59, 0xBE, 0xDF, 0x02, 0x00, 0x00, 0x9F };

#define moisture_input 0 // analog pin 0, nail 1
#define divider_top 1 // resistor analog pin 1
#define divider_bottom 2 // nail 2 analog pin 2
int waterPump =A5; // water pump analog pin 5
int moisture;
int Koguprotsent;
int tempHigh =A3; // window open relay
int tempLow =A4; //window close relay

int X=0;

void setup(void)
{

pinMode (tempLow, OUTPUT);
pinMode (tempHigh, OUTPUT);
pinMode (waterPump, OUTPUT);
digitalWrite(waterPump, LOW);
digitalWrite (tempLow, LOW);
digitalWrite (tempHigh, LOW);

// set up the LCD's number of columns and rows:
lcd.begin(16, 2);

// start serial port
Serial.begin(9600);

// Start up the library
sensors.begin();

// set the resolution to 10 bit (good enough?) maybe 9 bit better
sensors.setResolution(insideThermometer, 9);
// sensors.setResolution(outsideThermometer, 9);
// sensors.setResolution(dogHouseThermometer, 9);
}

void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
Serial.print("Error getting temperature");
} else {
Serial.print("C: ");
Serial.print(tempC);
//-- panin koodi siia..
}

if (tempC >= 27 && X ==0){
digitalWrite(tempHigh, HIGH);
delay(6000);
digitalWrite(tempHigh, LOW);
X = 1;
}

if (tempC <= 24 && X ==1){
//luuk alla
X = 0;

digitalWrite(tempLow, HIGH);
delay(6000);
digitalWrite(tempLow, LOW);
}

}

void loop(void)
{

{
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd.clear();
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd.write(Serial.read());
}
}
}

//---- soil

// Serial.print("Getting Soil Moisture...\n\r");
moisture=SoilMoisture(); // soilmoister as variable
Koguprotsent = ((moisture*100)/970); // mina sain max väärtuseks 950
Serial.print("Niiskuse absoluut arv: ");
Serial.println(moisture);

Serial.print("Mullas on niiskust ");
Serial.print(Koguprotsent);
Serial.print(" % ");

Serial.println();

delay(1000); // tuleks sättida endale sobivaks.

if (Koguprotsent >= 90){

digitalWrite(waterPump, LOW);

}
if (Koguprotsent <= 75){

digitalWrite(waterPump, LOW);
delay(1000); //pumba töö aeg.Katsetamise käigus selgub palju oleks normaalne aeg pumba tööks,et ei tekiks uputust.
digitalWrite(waterPump, HIGH);

}

//---------- temp
delay(1000);
Serial.print("Getting temperatures...\n\r");
sensors.requestTemperatures();

Serial.print("Inside temperature is: ");
printTemperature(insideThermometer);
Serial.print("\n\r");
// Serial.print("Outside temperature is: ");
// printTemperature(outsideThermometer);
// Serial.print("\n\r");
// Serial.print("Dog House temperature is: ");
// printTemperature(dogHouseThermometer);
// Serial.print("\n\r\n\r");
}

int SoilMoisture(){
int reading;
// set driver pins to outputs
pinMode(divider_top,OUTPUT);
pinMode(divider_bottom,OUTPUT);

// drive a current through the divider in one direction
digitalWrite(divider_top,LOW);
digitalWrite(divider_bottom,HIGH);

// wait a moment for capacitance effects to settle
delay(1000);

// take a reading
reading=analogRead(moisture_input);

// reverse the current
digitalWrite(divider_top,HIGH);
digitalWrite(divider_bottom,LOW);

// give as much time in 'reverse' as in 'forward'
delay(1000);

// stop the current
digitalWrite(divider_bottom,LOW);

return reading;

//relays for temp
pinMode(tempHigh,OUTPUT);

}

If you want help then ask a proper question. Also post your code correctly.
Read the how to use this forum stick post at the start of this section.

I got it