Serial Communication With Arduino Laboratory Activity
Serial Communication With Arduino Laboratory Activity
Objective: To understand serial communication between Arduino and a computer using the Serial
Monitor.
Materials:
2. USB cable
3. LEDs
4. Resistors
5. Breadboard
6. Jumper wires
Circuit Diagram: Connect an LED to digital pin 13 of the Arduino through a current-limiting resistor.
Procedure:
The setup() function initializes pin 13 as an output and starts serial communication at a baud
rate of 9600.
The loop() function checks if there are incoming serial data available.
If a character '1' is received, it turns on the LED and sends a message to the Serial Monitor.
If a character '0' is received, it turns off the LED and sends a message to the Serial Monitor.
Procedure:
1. Open the Arduino IDE and upload the code to the Arduino board.
2. Open the Serial Monitor (Ctrl+Shift+M) and set the baud rate to 9600.
3. Type '1' and press Enter to turn on the LED. Observe the LED on the breadboard.
4. Type '0' and press Enter to turn off the LED. Observe the LED state.
1. Experiment: Modify the code to control multiple LEDs using different serial commands ('1', '2',
'3', etc.).
2. Question: What changes are required in the Arduino code to control three LEDs connected to
pins 13, 12, and 11?