Learn to send and receive data through the serial port for debugging and communication.
Wire Color Connections:
Pin Configuration:
// Serial Communication Example
void setup() {
// Initialize serial communication at 9600 baud
Serial.begin(9600);
Serial.println(\"Arduino Serial Communication Started!\");
}
void loop() {
// Check if data is available to read
if (Serial.available() > 0) {
// Read the incoming byte
char incomingByte = Serial.read();
// Echo back what was received
Serial.print(\"I received: \");
Serial.println(incomingByte);
}
// Send a message every 2 seconds
Serial.println(\"Hello from Arduino!\");
delay(2000);
}