-
Notifications
You must be signed in to change notification settings - Fork 775
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding arduino sparkle motion mini example
- Loading branch information
1 parent
b477820
commit 94ce890
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...duino_Sparkle_Motion_Mini_Multi_NeoPixels/Arduino_Sparkle_Motion_Mini_Multi_NeoPixels.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// 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() { | ||
Serial.begin(115200); | ||
|
||
STRIP_1.begin(); | ||
STRIP_2.begin(); | ||
} | ||
|
||
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 pixelHue_1 = pixelHue_1 + (i * 65536L / STRIP_1.numPixels()); | ||
STRIP_1.setPixelColor(i, STRIP_1.gamma32(STRIP_1.ColorHSV(pixelHue_1))); | ||
} | ||
STRIP_1.show(); | ||
|
||
pixelHue_2 -= 256; | ||
for(int i=0; i<STRIP_2.numPixels(); i++) { | ||
int pixelHue_2 = pixelHue_2 + (i * 65536L / STRIP_2.numPixels()); | ||
STRIP_2.setPixelColor(i, STRIP_2.gamma32(STRIP_2.ColorHSV(pixelHue_2))); | ||
} | ||
STRIP_2.show(); | ||
|
||
delay(10); | ||
|
||
} |