The main use of the Sparkle Motion Stick is lighting up RGB LEDs to dazzle and delight. Using the Sparkle Motion 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 Stick and see how you can write code to run two different LED animations on two strips of NeoPixels at the same time.
NeoPixels
- terminal block - to GND on one NeoPixel strip. (black wire)
- terminal block + to 5V on one NeoPixel strip. (red wire)
- GND on one NeoPixel strip to GND on the other NeoPixel strip (black wire)
- 5V on one NeoPixel strip to 5V on the other NeoPixel strip (red wire)
- terminal block 21 to DIN on the first NeoPixel strip. (orange wire)
- terminal block 22 to DIN on the second NeoPixel strip. (yellow wire)
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 21 #define BLOCK_2 22 #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(uint 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 Stick. You'll see both strips cycle through the rainbow swirl, but in a different order on each strip.
Page last edited May 20, 2025
Text editor powered by tinymce.