0% found this document useful (0 votes)
4 views

Serial Communication With Arduino Laboratory Activity

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Serial Communication With Arduino Laboratory Activity

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Serial Communication with Arduino

Objective: To understand serial communication between Arduino and a computer using the Serial
Monitor.

Materials:

1. Arduino Uno board

2. USB cable

3. LEDs

4. Resistors

5. Breadboard

6. Jumper wires

Task 1: Blinking LED with Serial Commands

Circuit Diagram: Connect an LED to digital pin 13 of the Arduino through a current-limiting resistor.

Procedure:

1. Connect the components as per the circuit diagram.

2. Upload the following Arduino code:


Explanation:

 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.

Task 2: Serial Monitor Control

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.

Task 3: Experiment and Questions

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?

You might also like