The main use of the Sparkle Motion Mini is lighting up RGB LEDs to dazzle and delight. Using the Sparkle Motion Mini with Arduino involves installing the Adafruit_NeoPixel library and running the provided example code. In the example below, you'll attach two NeoPixel strips to the Sparkle Motion Mini and see how you can write code to run two different LED animations on two strips of NeoPixels at the same time.
- Terminal block G to GND on both NeoPixel strips. (black wire, going through breadboard GND rail)
- Terminal block 5V to VIN on both NeoPixel strips. (red wire, going through breadboard power rail)
- Terminal block 33 to DIN on the first NeoPixel strip. (green wire)
- Terminal block 32 to DIN on the second NeoPixel strip. (green wire)
Library Installation
You can install the Adafruit NeoPixel library for Arduino using the Library Manager in the Arduino IDE.
Click the Manage Libraries ... menu item, search for Adafruit NeoPixel and select the Adafruit NeoPixel library:
No additional dependencies are required for the NeoPixel library.
// SPDX-FileCopyrightText: 2025 Liz Clark for Adafruit Industries // // SPDX-License-Identifier: MIT #include <Adafruit_NeoPixel.h> #define BLOCK_1 33 #define BLOCK_2 32 #define NUM_PIXELS 8 Adafruit_NeoPixel STRIP_1(NUM_PIXELS, BLOCK_1, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel STRIP_2(NUM_PIXELS, BLOCK_2, NEO_GRB + NEO_KHZ800); void setup() { STRIP_1.begin(); STRIP_2.begin(); STRIP_1.setBrightness(25); STRIP_2.setBrightness(50); } uint16_t pixelHue_1 = 0; uint16_t pixelHue_2 = 256; void loop() { pixelHue_1 += 256; for(int i=0; i<STRIP_1.numPixels(); i++) { int hue_1 = pixelHue_1 + (i * 65536L / STRIP_1.numPixels()); STRIP_1.setPixelColor(i, STRIP_1.gamma32(STRIP_1.ColorHSV(hue_1))); } STRIP_1.show(); pixelHue_2 -= 256; for(int i=STRIP_2.numPixels(); i>-1; i--) { int hue_2 = pixelHue_2 + (i * 65536L / STRIP_2.numPixels()); STRIP_2.setPixelColor(i, STRIP_2.gamma32(STRIP_2.ColorHSV(hue_2))); } STRIP_2.show(); delay(10); }
Upload the example code to the Sparkle Motion Mini. You'll see both strips cycle through the rainbow swirl, but in a different order on each strip.
Page last edited January 24, 2025
Text editor powered by tinymce.