1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-04 15:24:12 +01:00
Arduino/hardware/libraries/LiquidCrystal/examples/SerialDisplay/SerialDisplay.pde

35 lines
704 B
Plaintext
Raw Normal View History

2008-09-07 14:21:07 +02:00
/*
* Displays text sent over the serial port (e.g. from the Serial Monitor) on
* an attached LCD.
*/
2008-04-19 05:31:36 +02:00
#include <LiquidCrystal.h>
2008-09-07 14:21:07 +02:00
// LiquidCrystal display with:
// rs on pin 12
// rw on pin 11
// enable on pin 10
// d0, d1, d2, d3 on pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
2008-04-19 05:31:36 +02:00
void setup()
{
Serial.begin(9600);
}
void loop()
{
2008-09-07 14:21:07 +02:00
// when characters arrive over the serial port...
2008-04-19 05:31:36 +02:00
if (Serial.available()) {
2008-09-07 14:21:07 +02:00
// wait a bit for the entire message to arrive
2008-04-19 05:31:36 +02:00
delay(100);
2008-09-07 14:21:07 +02:00
// clear the screen
2008-04-19 05:31:36 +02:00
lcd.clear();
2008-09-07 14:21:07 +02:00
// read all the available characters
2008-04-19 05:31:36 +02:00
while (Serial.available() > 0) {
2008-09-07 14:21:07 +02:00
// display each character to the LCD
2008-04-19 05:31:36 +02:00
lcd.write(Serial.read());
}
}
}