# Your First Blinking LED: WS2812 RGB LED Guide
## Introduction
Welcome to your first ESP32 project! 🎉 You're about to make your **Lonely Binary ESP32** light up with beautiful colors. This is the "Hello World" of electronics - your first step into the amazing world of microcontroller programming!

## What is a WS2812 LED?
### Regular LED vs WS2812 LED
**Regular LED:**
- ❌ Only one color (usually red, green, or blue)
- ❌ Simple on/off control
- ❌ Basic blinking
**WS2812 LED (What you have!):**
- ✅ **16 million colors!** (Red, Green, Blue combinations)
- ✅ **Smart control** (can change colors instantly)
- ✅ **Beautiful effects** (rainbow, fade, pulse, etc.)
- ✅ **Easy to program** (one wire controls everything)
### Think of it like this:
- **Regular LED** = A simple light bulb (on/off)
- **WS2812 LED** = A smart TV screen (millions of colors, effects, animations)
## Step 1: Install the FastLED Library
### What is FastLED?
**FastLED** is a library that makes it super easy to control WS2812 LEDs. Think of it as a "remote control" for your LED.
### How to Install FastLED
1. **Open Arduino IDE**
2. **Go to Library Manager:**
- Click **Sketch** → **Include Library** → **Manage Libraries**
- Or press `Ctrl + Shift + I` (Windows) / `Cmd + Shift + I` (Mac)
3. **Search for FastLED:**
- In the search box, type "FastLED"
- Look for "FastLED by Daniel Garcia"
- Click on it
4. **Install FastLED:**
- Click the **"Install"** button
- Wait for installation to complete
- Click **"Close"**
✅ **Great!** FastLED is now installed and ready to use!

## Step 2: Your First Blinking LED Program
### Create a New Sketch
1. **Open Arduino IDE**
2. **Create new sketch:** File → New
3. **Replace the code** with this:
```cpp
// Your First WS2812 LED Program
// Lonely Binary ESP32-S3 N16R8
#include <FastLED.h>
// LED Configuration
#define LED_PIN 2 // WS2812 LED is connected to GPIO 48
#define NUM_LEDS 1 // We have 1 LED
#define BRIGHTNESS 50 // Brightness (0-255, lower = dimmer)
// Create LED array
CRGB leds[NUM_LEDS];
void setup() {
// Initialize the LED
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
// Clear all LEDs (turn them off)
FastLED.clear();
FastLED.show();
// Start serial communication (for debugging)
Serial.begin(115200);
Serial.println("WS2812 LED Test - Lonely Binary ESP32-S3");
Serial.println("LED should start blinking in different colors!");
}
void loop() {
// Red blink
Serial.println("Red blink");
leds[0] = CRGB::Red;
FastLED.show();
delay(1000);
// Turn off
leds[0] = CRGB::Black;
FastLED.show();
delay(500);
// Green blink
Serial.println("Green blink");
leds[0] = CRGB::Green;
FastLED.show();
delay(1000);
// Turn off
leds[0] = CRGB::Black;
FastLED.show();
delay(500);
// Blue blink
Serial.println("Blue blink");
leds[0] = CRGB::Blue;
FastLED.show();
delay(1000);
// Turn off
leds[0] = CRGB::Black;
FastLED.show();
delay(500);
}
```
### What This Code Does
**Setup Section:**
- `#include <FastLED.h>` - Includes the FastLED library
- `#define LED_PIN 2` - Tells the program the LED is on GPIO 2
- `#define NUM_LEDS 1` - We have 1 LED
- `#define BRIGHTNESS 50` - Sets LED brightness (0-255)
**Loop Section:**
- **Red blink** → **Off** → **Green blink** → **Off** → **Blue blink** → **Off**
- Repeats forever!
## Step 3: Upload Your Program

### Check Your Settings
1. **Board Selection:**
- Tools → Board → ESP32 Arduino → ESP32 Dev Module
2. **Port Selection:**
- Tools → Port → Select your ESP32 port
- Should show something like:
- Windows: `COM3`, `COM4`, etc.
- Mac: `/dev/cu.usbserial-XXXXXX`
1. **Upload Speed:**
- Tools → Upload Speed → `460800` (or `115200` if you have issues)
### What Should Happen
After upload, your ESP32-S3 should:
- **Blink red** for 1 second
- **Turn off** for 0.5 seconds
- **Blink green** for 1 second
- **Turn off** for 0.5 seconds
- **Blink blue** for 1 second
- **Turn off** for 0.5 seconds
- **Repeat forever!**
**Congratulations!** You've taken your first step into the amazing world of microcontroller programming! 🎉
---
## Support
If you encounter any issues, please go to [https://lonelybinary.com](https://lonelybinary.com) and click the Support button located in the bottom right corner. Our team is ready to assist you.
[](https://lonelybinary.com)
or contact us at office@lonelybinary.com
**Keep experimenting and have fun with your colorful LED!** 🌈✨
- Choosing a selection results in a full page refresh.