#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x3F for a 16 chars and 2 line display
void serialDisp();
void setup() {
Serial.begin(9600);
Serial.println("Input Text");
// lcd.begin();
lcd.init();
lcd.clear();
lcd.backlight(); // Make sure backlight is on
// Print a message on both lines of the LCD.
lcd.setCursor(2,0); //Set cursor to character 2 on line 0
lcd.print("Hello world!");
lcd.setCursor(2,1); //Move cursor to character 2 on line 1
lcd.print("LCD Tutorial");
lcd.clear();
}
void loop() {
serialDisp();
}
void xam1(){
lcd.clear();
lcd.print("Hello World!");
delay(1000);
lcd.clear();
lcd.print("I'm powered by");
lcd.setCursor(3, 1);
lcd.print("Arduino!");
delay(1000);
lcd.clear();
lcd.print("Please subscribe!");
delay(1000);
lcd.clear();
lcd.print("Goodbye!");
delay(1000);
lcd.clear();
}
void serialDisp(){
// If characters arrived over the serial port...
if (Serial.available()) {
// Wait a bit for the entire message to arrive
delay(100);
// Clear the screen
lcd.clear();
// Write all characters received with the serial port to the LCD.
while (Serial.available() > 0) {
lcd.write(Serial.read());
}
}
delay(1000);
}