#include <LiquidCrystal.h>
// Define LCD Pins
#define RS 12 // Register Select
#define E 11 // Enable pin
#define D4 5 // Data pin 4
#define D5 4 // Data pin 5
#define D6 3 // Data pin 6
#define D7 2 // Data pin 7
// Create an LCD object
LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
void setup() {
// Start serial communication at 9600 baud
Serial.begin(9600);
// Initialize the LCD
lcd.begin(16, 2); // Set the LCD's dimensions (16 columns, 2 rows)
// Print an initial message
lcd.print("Waiting for data...");
}
void loop() {
// Send the name "Shree Varsaan" via UART
if (Serial.available()) {
String receivedData = Serial.readString(); // Read incoming data
// Clear the LCD and print the received data
lcd.clear();
lcd.print("Received:");
lcd.setCursor(0, 1); // Move to second line
lcd.print(receivedData);
}
}