problem--> Serial port to LCD

Hi everyone,

I write a SerialLCD program?to accept data from Serial Port (sent from a PC or laptop), and then the information is displayed on the LCD.

I can't receiver any data but LCD can display.

#include <LiquidCrystal.h>

LiquidCrystal lcd(3, 4, 5, 8, 9, 10, 11);

void setup() 
{

  //lcd.clear(); 
  lcd.begin(16, 2);
  //lcd.setCursor(0,2);  
  lcd.print("Donald*-*");
  //lcd.clear(); 
  Serial.begin(9600); 
  //delay(1000);  
  
}

void loop() 
{
  int incomingByte = 0;
  if(Serial.available()) 
  {
    //delay(50);
    //lcd.clear();
    while (Serial.available() > 0)
   { 
    incomingByte = Serial.read();
    Serial.print("I received: ");
    Serial.println(incomingByte, DEC); 
    lcd.write(Serial.read());
   }  
  }
  /*
        if (Serial.available() > 0) 
        {
                // read the incoming byte:
                incomingByte = Serial.read();

                // say what you got:
                Serial.print("I received: ");
                Serial.println(incomingByte, DEC);
                   //lcd.write(Serial.read());
        }
*/
}

Have you looked at the 'SerialDisplay' example that comes with the LiquidCrystal library?

Don

There is a logic mistake within these 4 lines:

incomingByte = Serial.read();
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
lcd.write(Serial.read());

If you read serial port on line 1, the incoming byte is removed from serial port. Think what that will do to line 4.