Printing to LCD.

I was wondering if it's possible to print what you type into a serial port on an LCD. I have it so it prints the byte it receives which I have no idea why it does that but it works so I'll post the code if you'd like to take a look and give me some pointers.

Do you mean a code like this? It’s in your Arduino software under examples. You can check out ladyada’s tutorial on LCDs if you are new to it. :wink:

/*
 * Displays text sent over the serial port (e.g. from the Serial Monitor) on
 * an attached LCD.
 */

#include <LiquidCrystal.h>

// LiquidCrystal display with:
// rs on pin 12
// rw on pin 11
// enable on pin 10
// d4, d5, d6, d7 on pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  // when characters arrive over the serial port...
  if (Serial.available()) {
    // wait a bit for the entire message to arrive
    delay(100);
    // clear the screen
    lcd.clear();
    // read all the available characters
    while (Serial.available() > 0) {
      // display each character to the LCD
      lcd.write(Serial.read());
    }
  }
}

Hmm, I'll test this code out now. Also, where are these tutorials?

Do you mean like the "LiquidCrystal - Serial Input" example at http://arduino.cc/en/Tutorial/LiquidCrystalSerial?

Don

Also, where are these tutorials?

I gave you one location in my previous post. There are also examples buried in your Arduino download. Mine are here: "C:\Arduino\arduino-0017\hardware\libraries\LiquidCrystal\examples"

Don

This code you posted is not working for me. Maybe it’s my wiring again :confused:
Was not my wiring I just made a few edits though.

Perhaps you should follow up on your other (Hardware | Troubleshooting) thread, where you thought you fixed your display problem.

Don

No, I fixed the code. It wasn't working right. The hardware problem was OK. :D

It looks as if the Hacktronics example and the code in reply #1 are written for an earlier version of LiquidCrystal than the one that comes with Arduino v0017.

If you are still having problems (I can't be sure from your posts) I suggest you take a look at the example sketches that come in the Arduino download.

Don