A colorful RGB LED demo for M5Stack AtomS3 Lite with 4 different lighting modes.
| Mode | Description |
|---|---|
| 🌈 Rainbow Cycle | Smoothly cycles through all colors |
| 💨 Breathing | Fades in and out with current color |
| ✨ Random Blink | Changes to random colors every 200ms |
| 🎨 Button Control | Manually select from 8 preset colors |
- M5Stack AtomS3 Lite
- RGB LED: GPIO 35
- Button: GPIO 41
- PlatformIO installed
- USB-C cable
- Clone or download this repository:
git clone https://github.com/QQSHI13/atoms3-rainbow.git
cd atoms3-rainbow- Open in PlatformIO:
pio run --target uploadOr use VS Code with PlatformIO extension.
- Long press button (>500ms): Switch between 4 modes
- Serial Monitor (115200 baud): See current mode
- Automatically cycles through rainbow colors
- Updates every 20ms for smooth transition
- Current color fades in and out
- Relaxing breathing-like effect
- Jumps to random color every 200ms
- Party mode!
- Short press: Cycle through 8 colors (Red, Green, Blue, Yellow, Purple, Cyan, Orange, White)
- Color name printed to Serial Monitor
// In rainbowCycle()
if (millis() - lastUpdate > 10) // Lower = faster// In setup()
FastLED.setBrightness(200); // 0-255, default is 128// In buttonControl()
CRGB colors[] = {
CRGB::Red,
CRGB::Green,
CRGB(255, 100, 0), // Custom orange
// Add more...
};atoms3-rainbow/
├── platformio.ini # PlatformIO configuration
├── src/
│ └── main.cpp # Main source code
└── README.md # This file
rainbowCycle(): Increments hue value, creates smooth color transitionbreathingEffect(): Sine wave-like brightness modulationrandomBlink(): Usesrandom8()for random huebuttonControl(): Debounced button reading with color cyclingcheckModeButton(): Long press detection for mode switching
- FastLED: LED control library
No wiring needed! AtomS3 Lite has built-in RGB LED on GPIO 35.
For external LED (optional):
- Connect SK6812/WS2812 LED data pin to GPIO 35
- Connect GND to GND
- Connect VCC to 3.3V or 5V
GPL-3.0 License - See LICENSE for details.
Enjoy your colorful AtomS3 Lite! 🦐✨
