void setup() {
// Start the serial communication at 9600 baud rate
Serial.begin(9600);
// Print a message to the serial monitor
Serial.println("Enter a character:");
}
void loop() {
// Check if data is available to read
if (Serial.available() > 0) {
// Read the incoming byte
int incomingByte = Serial.read();
// Print the received byte as a character
Serial.print("I received: ");
Serial.println((char)incomingByte);
}
}