So I have a standard 16x2 LCD display with 16 pins. The LCD display works fine with every other aspect, however, the "lcd.clear" function doesn't work with "Serial.begin(ANY BAUD)". I have tried changing bauds and downgrading the board software but it still doesn't work.

Basically, instead of clearing the display like it should do, it displays a weird character with 4 horizontal lines (in one character space) and then continues to write stuff after it.

Here is my code:

#include <LiquidCrystal.h> 
LiquidCrystal lcd(1, 2, 4, 5, 6, 7); 

void setup() { 
 pinMode(8, INPUT);

void loop() { 

Whenever I delete the Serial.begin everything works fine, but when I add it the clear function doesn't work anymore.

So in this case, what happens is that the Arduino prints "incorrect", then instead of clearing the display, it prints out four horizontal lines, and then continues to print out "incorrect" infinitely.

  • You seem to use UART pins to connect your LCD. Commented Jul 9, 2019 at 10:50

2 Answers 2


Pins 0 and 1 are the hardware serial pins on the Mega. If you're going to use Serial, then you can't connect your LCD to those pins or it won't work. Even if you are only connected to Serial through the USB, pins 0 and 1 are still acting as Tx and Rx.

  • Right thank you so much!
    – Leo Feng
    Commented Jul 9, 2019 at 3:59
  • 1
    Can you please mark the answer as accepted.
    – Delta_G
    Commented Jul 9, 2019 at 4:42

Buddy you are using those pins which are used for communication purpose that is pin No. 0 and 1 is for RXD and TXD See the image you will observe what you are trying to do is wrong

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.