Random characters generated by LCD during serial.read() I am using the following codes to print characters on LCD display....

#include &lt;LiquidCrystal.h&gt;

const int rs = 8, en = 9, d0 = 4, d1 = 5, d2 = 6, d3 = 7;
LiquidCrystal lcd(rs, en, d0, d1, d2, d3);

void setup() {
  lcd.begin(16, 2);
  Serial.begin(9600);
}

void loop() {
  if (Serial.available()) {
    delay(100);
    lcd.clear();
    while (Serial.available() &gt; 0) {
      lcd.write(Serial.read());
    }
  }
}


but in the end it is generating an unwanted character also..


kindly help me with the problem
The character to the right of the 'A' on your LCD display does not correspond to any of the built-in character bitmap definitions (either on a EU or Chinese display).  This random pattern is likely one of the 8 programmable character bitmaps supported by the LCD that has not been defined yet (ASCII codes 0 to 7).

So, you're likely sending the LCD a character with a value between 0 and 7.  It's probably a good idea to filter out invalid characters before attempting to display them on your LCD.

Filtering Example:

char c = Serial.read();
if ((c &gt;= 32) &amp;&amp; (c &lt;= 128))
  lcd.write(c);