void setup() { Serial.begin(9600); // Initialize UART communication at 9600 baud Serial.setTimeout(1000); // Set a timeout for Serial.read() } void loop() { if (Serial.available() > 0) { // Check if data is available to read String message = Serial.readString(); // Read the incoming message Serial.print("Received: "); Serial.println(message); // Print the received message to the Serial Monitor } }