0% found this document useful (0 votes)
32 views2 pages

Exp#1

Uploaded by

theskylover88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views2 pages

Exp#1

Uploaded by

theskylover88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Experiment No.

1: Blinking an LED with ESP32 and Arduino IDE


Objective
To familiarize students with the ESP32 microcontroller and Arduino IDE by creating a basic
"Hello World" program that blinks an LED.

Materials Required
■ ESP32 development board
■ USB cable
■ Breadboard
■ LED (any color)
■ 220-ohm resistor
■ Jumper wires
■ Computer with Arduino IDE installed

Procedure
1. Setup Arduino IDE for ESP32:
○ Open Arduino IDE.
○ Go to File > Preferences.
○ In the "Additional Boards Manager URLs" field, add the following URL:
https://dl.espressif.com/dl/package_esp32_index.json.
○ Go to Tools > Board > Boards Manager.
○ Search for "ESP32" and install the "esp32" package by Espressif Systems.
2. Connect ESP32 to Computer:
○ Connect the ESP32 board to your computer using the USB cable.
○ Select the correct board and port in Arduino IDE:
■ Go to Tools > Board and select your ESP32 board model.
■ Go to Tools > Port and select the port to which the ESP32 is connected.
3. Circuit Setup:
○ Place the LED on the breadboard.
○ Connect the longer leg (anode) of the LED to a digital pin (e.g., GPIO 2) on the
ESP32 using a jumper wire.
○ Connect the shorter leg (cathode) of the LED to one end of the 220-ohm
resistor.
○ Connect the other end of the resistor to the GND pin on the ESP32.
4. Write the Code:
○ Open a new sketch in Arduino IDE and write the following code:
// Start of program
// Define the LED pin
const int ledPin = 2;

void setup() {
// Initialize the digital pin as an output
pinMode(ledPin, OUTPUT);
}

void loop() {
// Turn the LED on (HIGH is the voltage level)
digitalWrite(ledPin, HIGH);
// Wait for a second
delay(1000);
// Turn the LED off by making the voltage LOW
digitalWrite(ledPin, LOW);
// Wait for a second
delay(1000);
}
// End of program

5. Upload the Code:


• Click the upload button (right arrow) in Arduino IDE to compile and upload the
code to the ESP32.
• Ensure the ESP32 is in boot mode if required (press the BOOT button on the
ESP32 board while uploading).
6. Observe the Output:
• Once the code is uploaded, the LED should start blinking with a 1-second
interval, indicating the "Hello World" program is running successfully.

Discussion
● Explain the significance of each part of the code, such as pinMode, digitalWrite, and
delay.
● Discuss how this basic experiment can be extended to control other devices or
integrate with sensors.

Conclusion
This experiment introduces students to the basics of programming the ESP32 using Arduino IDE
and demonstrates how to control an output device (LED) using simple code.

Rubrics
Needs Improvement
Criteria Excellent (2) Good (1)
(0)

Correctly installed
Installed Arduino IDE and Did not install
Arduino IDE, added
Setup and added ESP32 board but had Arduino IDE or add
ESP32 board, and
Preparation minor issues with ESP32 board
selected the correct
board/port selection. correctly.
board and port.

Assembled the circuit with


Circuit Assembled the circuit Did not assemble the
minor errors that were
Assembly correctly with no errors. circuit correctly.
corrected.

Wrote the code correctly Wrote the code with minor


Did not write the
Code Writing with no syntax errors syntax errors or missing
code correctly.
and proper comments. comments.

Uploaded the code Uploaded the code


Did not upload the
Code Uploading successfully on the first successfully after minor
code successfully.
attempt. troubleshooting.

LED blinks as expected LED blinks with minor timing LED does not blink
Functionality
with correct timing. issues. as expected.

You might also like