I get extra character (frowning face) when sending a text over the serial monitor(see attached image)

extra character serial monitor

When empty string is sent over the serial monitor, the LCD display still shows the extra character of frowning face.

How do I get rid of the extra character?

I use the tutorial code below and change nothing in the code. https://www.arduino.cc/en/Tutorial/LibraryExamples/LiquidCrystalSerialDisplay/

#include <LiquidCrystal.h>
    // initialize the library by associating any needed LCD interface pin
    // with the arduino pin number it is connected to
    const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
    LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
    void setup() {
      // set up the LCD's number of columns and rows:
      lcd.begin(16, 2);
      // initialize the serial communications:
    void loop() {
      // when characters arrive over the serial port...
      if (Serial.available()) {
        // wait a bit for the entire message to arrive
        // clear the screen
        // read all the available characters
        while (Serial.available() > 0) {
          // display each character to the LCD
  • 2
    Change "Newline" to "No Line Ending", or handle the termination manually (not a bad idea). – dandavis Jan 27 at 6:33
  • I don't see that character in the common character sets for HD44780 type drivers. What exact display is it? And have you been playing round with character generator ram (custom characters)? – timemage Jan 27 at 16:19

The LCD display acts a bit different to a normal console. For instance, it does not recognize the newline character and uses the corresponding ASCII code (10) like a normal letter. Depending on the letter map of your display (for which there are several variants on the market) this will print a more or less random character. To avoid this, you have to strip the last letter from the input string before sending it to the display.

For the same reason, sending an empty string does nothing, since an empty string sends no letters. To clear individual characters in the display, you have to overwrite them with a space.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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