1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-10 00:46:09 +01:00

35 lines
704 B
Plaintext
Raw Normal View History

2008-09-07 12:21:07 +00:00
/*
* Displays text sent over the serial port (e.g. from the Serial Monitor) on
* an attached LCD.
*/
2008-04-19 03:31:36 +00:00
#include <LiquidCrystal.h>
2008-09-07 12:21:07 +00:00
// 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);
2008-04-19 03:31:36 +00:00
void setup()
{
Serial.begin(9600);
}
void loop()
{
2008-09-07 12:21:07 +00:00
// when characters arrive over the serial port...
2008-04-19 03:31:36 +00:00
if (Serial.available()) {
2008-09-07 12:21:07 +00:00
// wait a bit for the entire message to arrive
2008-04-19 03:31:36 +00:00
delay(100);
2008-09-07 12:21:07 +00:00
// clear the screen
2008-04-19 03:31:36 +00:00
lcd.clear();
2008-09-07 12:21:07 +00:00
// read all the available characters
2008-04-19 03:31:36 +00:00
while (Serial.available() > 0) {
2008-09-07 12:21:07 +00:00
// display each character to the LCD
2008-04-19 03:31:36 +00:00
lcd.write(Serial.read());
}
}
}