Built-in project · Seeed XIAO RP2040
XIAO RP2040 NeoPixel
The XIAO RP2040 powers its own NeoPixel from GPIO 11 and fades it around the color wheel on GPIO 12. The whole build, a Seeed XIAO RP2040, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.
Teaching? Assign it to your class in one click.
Beginner Runs in your browser. Free, and no account needed.
The parts retail for about $10.40. On Mokxi they're free.
Click to open it in the editor
The circuit itself, running here on the simulator. Press what can be pressed; click anything else to open it in the editor.
The code
The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.
sketch.ino · Seeed XIAO RP2040
// NeoPixel: the XIAO RP2040's own RGB LED.
//
// The NeoPixel is a WS2812 on GPIO 12 (PIN_NEOPIXEL), and its supply is
// switched by GPIO 11 (NEOPIXEL_POWER): drive that HIGH first, or the LED
// stays dark however much data it is sent, as on the real board.
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel pixel(1, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode(NEOPIXEL_POWER, OUTPUT);
digitalWrite(NEOPIXEL_POWER, HIGH);
pixel.begin();
pixel.setBrightness(60);
}
void loop() {
for (long hue = 0; hue < 65536; hue += 2048) {
pixel.setPixelColor(0, pixel.ColorHSV(hue));
pixel.show();
delay(40);
}
}
Parts list
2 parts, plus the jumper wires. They retail for about $10.40; on Mokxi they're free.
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.