D1 (ESP-12E) WiFi Development Board Documentation
The D1 (ESP-12E) WiFi Development Board is a microcontroller-based board that integrates Wi-Fi capabilities, making it ideal for IoT projects. It is based on the ESP-12E module, which is a popular and affordable Wi-Fi System on a Chip (SoC). This board is widely used in various applications, including smart home automation, robotics, and wearables.
Microcontroller: ESP-12E (ESP8266EX)
Wi-Fi: 802.11 b/g/n
Frequency: 2.4 GHz
Flash Memory: 4MB
SRAM: 520 KB
Operating Voltage: 3.3V
I/O Pins: 18 (including 2xUART, 1xSPI, 1xI2C, 1xI2S)
The D1 (ESP-12E) WiFi Development Board can be programmed using the Arduino Integrated Development Environment (IDE) or the ESP8266 SDK. The board supports a variety of programming languages, including C, C++, and Lua.
### Example 1: Wi-Fi Connectivity and LED Blinking
In this example, we will connect to a Wi-Fi network and blink an LED connected to GPIO Pin 2.
D1 (ESP-12E) WiFi Development Board
LED
220 Resistor
Breadboard and Jumper Wires
Arduino IDE (version 1.8.x or later)
Code
```c++
#include <WiFi.h>
const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";
void setup() {
Serial.begin(115200);
pinMode(2, OUTPUT); // LED Pin
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to Wi-Fi...");
}
Serial.println("Connected to Wi-Fi");
}
void loop() {
digitalWrite(2, HIGH);
delay(500);
digitalWrite(2, LOW);
delay(500);
}
```
### Example 2: Web Server using Wi-Fi
In this example, we will create a simple web server that displays a "Hello, World!" message.
D1 (ESP-12E) WiFi Development Board
Arduino IDE (version 1.8.x or later)
Code
```c++
#include <WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";
ESP8266WebServer server(80);
void setup() {
Serial.begin(115200);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to Wi-Fi...");
}
Serial.println("Connected to Wi-Fi");
// Start web server
server.begin();
}
void loop() {
server.handleClient();
}
void handleRoot() {
server.send(200, "text/plain", "Hello, World!");
}
```
In this example, we create a web server using the `ESP8266WebServer` library and define a single route to handle GET requests to the root URL (`"/"`). When a client connects to the server, it will display the "Hello, World!" message.
These examples demonstrate the capabilities of the D1 (ESP-12E) WiFi Development Board in various contexts, including Wi-Fi connectivity, LED control, and web server creation.