The ESP32 is a versatile and powerful microcontroller with integrated Wi-Fi and Bluetooth capabilities. It is widely used in Internet of Things (IoT) applications, smart home devices, and for prototyping wireless communication projects. The 38-pin variant provides ample GPIO pins for interfacing with a variety of sensors, actuators, and displays.
Pin Number | Function | Description |
---|---|---|
1-2 | GND | Ground |
3 | 3V3 | 3.3V power supply |
4-5 | EN | Chip enable. Active high. |
6-7 | VP, VN | Voltage for the internal Hall sensor |
8-9 | IO34, IO35 | Analog input (no pullup/pulldown) |
10-11 | IO32, IO33 | General purpose IO with DAC |
12-13 | IO25, IO26 | General purpose IO with DAC |
14-23 | IO14-IO23 | General purpose IO |
24-25 | IO13, IO12 | General purpose IO (used for boot mode sel.) |
26-27 | IO9, IO10 | General purpose IO (not exposed in all mods) |
28-29 | IO11, IO0 | General purpose IO (used for boot mode sel.) |
30 | GND | Ground |
31 | 5V | 5V power supply |
32-33 | TX0, RX0 | UART0 |
34-35 | IO1, IO3 | UART0; IO1 (TX), IO3 (RX) |
36-37 | IO21, IO19 | General purpose IO |
38 | IO18 | General purpose IO |
#include <WiFi.h>
// Replace with your network credentials
const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";
void setup() {
Serial.begin(115200);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
}
void loop() {
// Your code here
}
#include <WiFi.h>
: Include the Wi-Fi library for ESP32.const char* ssid
: Replace your_SSID
with your Wi-Fi network name.const char* password
: Replace your_PASSWORD
with your Wi-Fi network password.Serial.begin(115200)
: Initialize serial communication at 115200 baud rate.WiFi.begin(ssid, password)
: Start Wi-Fi connection with SSID and password.WiFi.status()
: Check the status of the Wi-Fi connection.Serial.println()
: Print messages to the serial monitor.Remember to adjust the SSID and password to match your Wi-Fi network's credentials before uploading the code to the ESP32.