LCD

Hi.. my LCD display row of block in first row after i click serial monitor on arduino software. before this, the LCD is okay. my project is rain sensor with ethernet shield . already check there is no solder problem and wired up correctly. this is my coding. please help me

#define RELAY1 7
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 1, 177);
EthernetServer server(80);

#include <LiquidCrystal.h>
int nRainIn = A1;
int nRainDigitalIn = 6;
int nRainVal;
boolean bIsRaining = false;
String strRaining;

LiquidCrystal lcd(5, 4, 3, 2, 1, 0);

void setup() {
Ethernet.begin(mac, ip);
server.begin();

lcd.begin(16,2);
lcd.print("status:");

pinMode(6,INPUT);
pinMode(RELAY1, OUTPUT);
}
void loop() {
nRainVal = analogRead(nRainIn);
bIsRaining = !(digitalRead(nRainDigitalIn));

if(bIsRaining){
strRaining = "YES";
digitalWrite(RELAY1,0); // Turns ON Relays 1
// lcd.println("Light ON");
}
else{
strRaining = "NO";
digitalWrite(RELAY1,1); // Turns Relay Off
//lcd.println("Light OFF");
}
lcd.begin(16, 2);
lcd.print("Raining?: ");
lcd.print(strRaining);
lcd.setCursor(0, 1);
lcd.print("\t Moisture Level: ");
lcd.println(nRainVal);

delay(200);
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("");
client.println("");
client.println("");
client.println("");
client.println("PSM2");
client.println("");
client.println("

RAIN STATUS AT UTHM

");

// output the value of each analog input pin

client.print("Raining?: ");
client.print(strRaining);
client.print("\t Moisture Level: ");
client.print(nRainVal);
client.println("
");
client.println("");
break;
}

}

}
}
// give the web browser time to receive the data

Ethernet.maintain();

}

You have no Serial.begin() in setup() so why open serial monitor? You are using the hardware serial Rx (pin 0) and TX (pin 1) pins for the LCD. You might want to use different pins for the LCD if you want to use Serial. Why call lcd.begin() every time through loop()? That really only needs to be done once in setup().

Please read the "how to use this forum-please read" stickies to see how to properly post code. Use the auto format tool (ctrl-t or Tools, AutoFormat) to indent your code properly for easier reading.

what i need to do if i dont want to use serial.

iraa:
what i need to do if i dont want to use serial.

Don't use it. Sleep easily.

sorry i am not understand. just want to display my lcd without using serial monitor

iraa:
sorry i am not understand. just want to display my lcd without using serial monitor

I don't see your problem - if you're not using the serial interface, you don't need the serial monitor.

Remove all Serial.xxx calls.

But you throw away a useful debugging tool. Keep pins 0 and 1 available if possible by moving those two wires to other pins (and obviously adjusting the code).

i dont understand.. can someone edit my coding.. i need to submit my project tomorrow ;(

Do a text search for any line containing the string "Serial".
Remove any statement or expression containing that string.

(deleted)