Learn GPIO, WiFi, Bluetooth, sensors, web dashboards, and ESP32-CAM basics.
ESP32 is more powerful than ESP8266. It has WiFi, Bluetooth, many GPIO pins, ADC inputs, PWM, touch pins, and camera support on ESP32-CAM boards.
const int ledPin = 2;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
}
const int ledPin = 2;
void setup() {
ledcAttach(ledPin, 5000, 8);
}
void loop() {
for (int value = 0; value <= 255; value++) {
ledcWrite(ledPin, value);
delay(10);
}
}
If your ESP32 core is older, use ledcSetup and ledcAttachPin instead.
#include <WiFi.h>
const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_WIFI_PASSWORD";
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(WiFi.localIP());
}
void loop() {
}
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
void setup() {
Serial.begin(115200);
SerialBT.begin("OpenRoboHub-ESP32");
}
void loop() {
if (SerialBT.available()) {
char command = SerialBT.read();
Serial.println(command);
}
}
Build an ESP32 dashboard that reads a sensor, hosts a web page, and displays live status.