This project drives the onboard WS2812 RGB LED on the Waveshare RP2040-Zero using the Raspberry Pi Pico SDK. The LED cycles through colors (Rainbow effect) with a period of approximately 1 minute.
- Smooth Color Cycling: Uses floating-point HSV to RGB conversion for seamless color transitions.
- High Refresh Rate: Updates the LED at 100Hz (every 10ms) for fluid animation.
- Precise Timing: Uses RP2040's PIO (Programmable I/O) block to drive WS2812 timing, ensuring stability independent of CPU load.
- Bright Colors: Saturation and Value are set to maximum for vivid output.
To build this project, you need the following installed on your system:
- Raspberry Pi Pico SDK: The build system will attempt to download it automatically if not found.
- CMake: Build system generator.
- ARM GCC Toolchain: Compiler for the RP2040 (
arm-none-eabi-gcc).- On macOS with Homebrew:
brew install --cask gcc-arm-embedded
- On macOS with Homebrew:
- Create a build directory:
mkdir build cd build - Configure the project (this will download the SDK if needed):
cmake .. -DPICO_SDK_FETCH_FROM_GIT=ON
- Compile:
make
- Hold the
BOOTbutton on the RP2040-Zero while plugging it into USB (or pressRESETwhile holdingBOOT). - The board will appear as a mass storage device named
RPI-RP2. - Drag and drop the generated
rp2040_zero_led.uf2file from thebuilddirectory onto theRPI-RP2drive.
main.c: Main application logic containing the HSV color conversion and animation loop.ws2812.pio: PIO assembly program handling the strict timing requirements of the WS2812 LED protocol.CMakeLists.txt: Build configuration for the Pico SDK.