File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #if 0 // Change to 1 to enable this code (must enable ONE user*.cpp only!)
2+
3+ #include <Adafruit_NeoPixel.h>
4+
5+ #define LED_PIN 8
6+ #define LED_COUNT 4
7+ Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
8+
9+ void user_setup(void) {
10+ strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
11+ strip.show(); // Turn OFF all pixels ASAP
12+ strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
13+ }
14+
15+ long firstPixelHue = 0;
16+
17+ void user_loop(void) {
18+ for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
19+ // Offset pixel hue by an amount to make one full revolution of the
20+ // color wheel (range of 65536) along the length of the strip
21+ // (strip.numPixels() steps):
22+ int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
23+ // strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or
24+ // optionally add saturation and value (brightness) (each 0 to 255).
25+ // Here we're using just the single-argument hue variant. The result
26+ // is passed through strip.gamma32() to provide 'truer' colors
27+ // before assigning to each pixel:
28+ strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
29+ }
30+ strip.show(); // Update strip with new contents
31+ firstPixelHue += 256;
32+ }
33+
34+ #endif // 0
You can’t perform that action at this time.
0 commit comments