LCD Serial Monitor Buffer

I have a I2C 20x4 LCD display. I would like to add this to a project I am working on.

The project uses a Mega ADK processor, and I have a good bit of data that I output to the serial monitor via "Serial.print();"

My dream would be to just redirect the serial monitor to go to my LCD, but from all my research, that isn't that easy. I have to go to each line that has "serial.print" and change it to "lcd.print" and I since I am just starting with this, I don't think "lcd.println()" exists.

But I had an idea. Would it be possible to wire the serial pins from the ADK to an arduino Nano and then just let the Nano run the LCD example of "whatever comes in on Serial.Read() gets printed to the LCD Display".

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

Has anyone tried this? Do you think it would work? Just toying with the idea.

vader7071:
I have to go to each line that has "serial.print" and change it to "lcd.print" and I since I am just starting with this, I don't think "lcd.println()" exists.

You can call it, but you will get garbage. The CR and LF characters print as - characters from the graphics set.

And - even worse on a 2004 - the display lines are not contiguous.

It is your task - in code - to format the display lines. There is no way around it.

Well, actually, there is - if you use Bill Perry's HD44780 library and examples installed from the IDE Library Manager, it actually will do a lot of this for you. I haven't tried it myself. It would however be vastly more sensible to properly organise the way you output in your original project.

And your "echo" code is wrong in so many ways - such as using delay() - that you should just forget it! Not even worth discussing. :roll_eyes:

Paul__B:
You can call it, but you will get garbage. The CR and LF characters print as - characters from the graphics set.

Thank you for this helpful information. I had not read up much on the LCD screen libraries yet, and I knew serial.print and serial.println were options, but I was not sure if those commands ported directly into the various LCD libraries.

Paul__B:
It is your task - in code - to format the display lines. There is no way around it.

Well, actually, there is - if you use Bill Perry's HD44780 library and examples installed from the IDE Library Manager, it actually will do a lot of this for you. I haven't tried it myself. It would however be vastly more sensible to properly organise the way you output in your original project.

For the most part, I can do this, however, one of the libraries I am using is reporting connection data via serial monitor and I am not sure exactly where in the library it is so I can add the "lcd.print" commands, but that will just take time digging around the library and figuring out where it is.

Paul__B:
And your "echo" code is wrong in so many ways - such as using delay() - that you should just forget it! Not even worth discussing. :roll_eyes:

And this part, well I'll just say thank you for your opinion, but I will choose to ignore this last part. I have found in the vast multitude of projects I have worked on that tossing ideas out like this lead to answers. The ideas may not be workable at their inception, but it gets ideas rolling and people talking. While you may not think this concept is worth discussing, this may be a concept others would like to tinker with and explore. Who knows what may be developed?

Thank you for your information and opinion.

vader7071:
For the most part, I can do this, however, one of the libraries I am using is reporting connection data via serial monitor and I am not sure exactly where in the library it is so I can add the "lcd.print" commands, but that will just take time digging around the library and figuring out where it is.

I find it somewhat bizarre that a library - other than one focused on serial output itself - would presume to use the serial output function without a proper API.

vader7071:
And this part, well I'll just say thank you for your opinion, but I will choose to ignore this last part. I have found in the vast multitude of projects I have worked on that tossing ideas out like this lead to answers.

I did not say that it was not practical, but that it was badly constructed. :roll_eyes: I can see why you might use it as a way of bypassing a faulty library, but it would need to be properly designed to start with. :sunglasses: