Your board has a built-in RGB NeoPixel status LED. You can use Arduino code to control the color and brightness of this LED. It is also used to indicate the bootloader status.
A NeoPixel is what Adafruit calls the WS281x family of addressable RGB LEDs. It contains three LEDs - a red one, a green one and a blue one - along side a driver chip in a tiny package controlled by a single pin. They can be used individually (as in the built-in LED on your board), or chained together in strips or other creative form factors. NeoPixels do not light up on their own; they require a microcontroller. So, it's super convenient that the NeoPixel is built in to your microcontroller board!
This page will cover using Arduino to control the status RGB NeoPixel built into your microcontroller. Time to get started!
Arduino Library Installation
You can install the necessary libraries from the Library Manager. To open, click Sketch > Include Library > Manage Libraries...
Search for NeoPixel, and install the Adafruit NeoPixel library.
There are no additional library dependencies for the Adafruit NeoPixel library.
// SPDX-FileCopyrightText: 2024 ladyada for Adafruit Industries // // SPDX-License-Identifier: MIT #include <Adafruit_NeoPixel.h> #define NUMPIXELS 1 Adafruit_NeoPixel pixel(NUMPIXELS, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800); void setup() { Serial.begin(115200); pixel.begin(); pixel.setBrightness(25); pixel.show(); } uint16_t firstPixelHue = 0; void loop() { firstPixelHue += 256; for(int i=0; i<pixel.numPixels(); i++) { int pixelHue = firstPixelHue + (i * 65536L / pixel.numPixels()); pixel.setPixelColor(i, pixel.gamma32(pixel.ColorHSV(pixelHue))); } pixel.show(); delay(10); }
Upload the sketch to your board. You'll see the onboard NeoPixel run through a looping rainbow animation.
Text editor powered by tinymce.