#include "FastLED.h" // dvb for Jordan's Hexagram dj lighter-upper // uses 198 WS2801 leds // WHITE:DATA // GREEN:CLOCK // RED:POWER +5 // BLUE:GND 0 unsigned char spoke[12][3]; unsigned char littleSpoke[12][2]; unsigned char innerRing[6]; void initMap() { spoke[0][0] = 66; spoke[0][1] = 127; spoke[0][2] = 153; spoke[1][0] = 5; spoke[1][1] = 129; spoke[1][2] = 199; spoke[2][0] = 78; spoke[2][1] = 131; spoke[2][2] = 159; spoke[3][0] = 16; spoke[3][1] = 134; spoke[3][2] = 196; spoke[4][0] = 89; spoke[4][1] = 136; spoke[4][2] = 163; spoke[5][0] = 27; spoke[5][1] = 138; spoke[5][2] = 194; spoke[6][0] = 99; spoke[6][1] = 140; spoke[6][2] = 169; spoke[7][0] = 38; spoke[7][1] = 142; spoke[7][2] = 191; spoke[8][0] = 109; spoke[8][1] = 144; spoke[8][2] = 175; spoke[9][0] = 49; spoke[9][1] = 146; spoke[9][2] = 189; spoke[10][0] = 119; spoke[10][1] = 148; spoke[10][2] = 181; spoke[11][0] = 60; spoke[11][1] = 150; spoke[11][2] = 186; littleSpoke[0][0] = 3; littleSpoke[0][1] = 4; littleSpoke[1][0] = 7; littleSpoke[1][1] = 6; littleSpoke[2][0] = 14; littleSpoke[2][1] = 15; littleSpoke[3][0] = 18; littleSpoke[3][1] = 17; littleSpoke[4][0] = 25; littleSpoke[4][1] = 26; littleSpoke[5][0] = 29; littleSpoke[5][1] = 28; littleSpoke[6][0] = 36; littleSpoke[6][1] = 37; littleSpoke[7][0] = 40; littleSpoke[7][1] = 39; littleSpoke[8][0] = 47; littleSpoke[8][1] = 48; littleSpoke[9][0] = 51; littleSpoke[9][1] = 50; littleSpoke[10][0] = 58; littleSpoke[10][1] = 59; littleSpoke[11][0] = 62; littleSpoke[11][1] = 61; innerRing[0] = 198; innerRing[1] = 197; innerRing[2] = 193; innerRing[3] = 192; innerRing[4] = 188; innerRing[5] = 187; } #define NUM_LEDS 200 // Data pin that led data will be written out over #define DATA_PIN 6 // Clock pin only needed for SPI based chipsets when not using hardware SPI #define CLOCK_PIN 7 // This is an array of leds. One item for each led in your strip. CRGB leds[NUM_LEDS]; // This function sets up the ledsand tells the controller about them void setup() { Serial.begin(115200); initMap(); FastLED.addLeds(leds, NUM_LEDS); for(int ix = 0; ix < NUM_LEDS; ix++) leds[ix] = CRGB::Black; } void pf(const char *s, int x) { Serial.print(s); Serial.print(x); } void cr() { Serial.print("\n"); } int ticks = 0; int k = 0; float hue = 0; void loop() { ticks++; k = (k + 1) % NUM_LEDS; hue += 0.7; if(hue >= 256) hue -= 256; int h = hue; for(int ix = 0; ix < NUM_LEDS; ix++) { int n = 4; int d = 8; leds[ix].r = leds[ix].r * n / d; leds[ix].g = leds[ix].g * n / d; leds[ix].b = leds[ix].b * n / d; } for(int ix = 0; ix < NUM_LEDS; ix += 27) { hue += 128.1; if(hue >= 256) hue -= 256; int h = hue; int jx = (ix + k) % NUM_LEDS; leds[jx] = CHSV(h, 255, 20); } int barInterval = 7; // if(ticks % barInterval == 0) { int bar = ticks / barInterval; bar %= 32; if(bar < 12) { for(int ix = 0; ix < 3; ix++) leds[spoke[bar][ix]] = CHSV(h, 255, 200); } else if(bar < 24) { bar -= 12; for(int ix = 0; ix < 2; ix++) leds[littleSpoke[bar][ix]] = CHSV(h, 255, 200); } else if(bar < 27) { h += 100; bar -= 24; for(int ix = 0; ix < 12; ix++) leds[spoke[ix][bar]] = CHSV(h, 255, 200); } else if(bar < 32) { h += 190 + bar * 123; for(int ix = 0; ix < 6; ix++) leds[innerRing[ix]] = CHSV(h, 255, 200); } } FastLED.show(); // Wait a little bit delay(40); }