# Adding ESP32 Support to Arduino IDE

## Here's how to program the ESP32 using the Arduino IDE.

### Step 1: Connect your ESP32 to your computer

You'll need a USB micro B cable to connect your ESP32 to your computer. Once connected, the `power LED` will light up on the board. If your computer doesn't automatically recognize the ESP32, you may need to install the CP2102 driver from [this link](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers).

### Step 2: Open Arduino IDE

Ensure you are using **Arduino IDE version 1.8.5 or later**. Here's how to set up ESP32 in the IDE:

1. Go to **File > Preferences** in the Arduino IDE.
2. In the **"Additional Boards Manager URLs"** field, paste the following URL:\
   `https://dl.espressif.com/dl/package_esp32_index.json`\
   Then, click **OK**.

   ![Preferences](https://github.com/debjyotiC/IOT_class/blob/master/images/arduino-ide-preferences-esp32.jpg)
3. Next, go to **Tools > Board > Board Manager**.
4. In the search bar, type "esp32" and select the **"esp32 by Espressif Systems"** option. Click **Install**.

   ![Board Manager](https://github.com/debjyotiC/IOT_class/blob/master/images/arduino-board-manager-esp32.jpg)

### Step 3: Make a LED Blink using ESP32

Now that your IDE is ready, let's upload a simple blink program.

Just like NodeMCU, the ESP32 has multiple GPIO pins. Refer to the ESP32 pinout below for pin naming conventions:

![ESP32 Pinout](https://randomnerdtutorials.com/wp-content/uploads/2018/08/ESP32-DOIT-DEVKIT-V1-Board-Pinout-36-GPIOs.jpg)

For this example, we'll use GPIO23 to blink an LED. Connect the LED to GPIO23 and upload the following code:

```cpp
// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 23 as an output.
  pinMode(23, OUTPUT);
}
 
// the loop function runs over and over again forever
void loop() {
  digitalWrite(23, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(23, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.consentiumiot.com/board-support/adding-esp32-support-to-arduino-ide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
