Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define LED_PIN 4
- #define NUM_LEDS 256
- #define BRIGHTNESS 64
- #define LED_TYPE WS2812
- #define COLOR_ORDER GRB
- CRGB leds[NUM_LEDS];
- #define UPDATES_PER_SECOND 100
- void setup()
- {
- delay( 3000 ); // power-up safety delay
- FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
- FastLED.setBrightness( BRIGHTNESS );
- }
- void loop()
- {
- static uint8_t startIndex = 0;
- //startIndex = startIndex + 1; /* motion speed */
- FillLEDsFromMyColors( startIndex);
- FastLED.show();
- FastLED.delay(1000 / UPDATES_PER_SECOND);
- }
- void FillLEDsFromMyColors( uint8_t colorIndex)
- {
- for( int i = 0; i < NUM_LEDS; i++) {
- leds[i] = ColorFromMyColors( colorIndex);
- colorIndex += 1;
- }
- }
- // forward declaration of 'myColors', which comes later
- extern const uint32_t myColors[] PROGMEM;
- // function to return a color from the PROGMEM color array,
- // sort of like ColorFromPalette.
- CRGB ColorFromMyColors( uint8_t index)
- {
- CRGB color = myColors[ index ];
- return color;
- }
- const uint32_t myColors[] PROGMEM = {
- 0x49538E, 0x242565, 0x362247, 0x231609, 0x3C2978, 0x59439D, 0x5E4C94, 0x4E3776,
- 0x021517, 0x00273F, 0x64221C, 0x974017, 0x1E2420, 0x071928, 0x061632, 0x000629,
- 0x00042E, 0x002754, 0x33312A, 0xA16203, 0xD67F03, 0x6C4E1B, 0x061B29, 0x042738,
- 0x08233E, 0x070921, 0x000B26, 0x19252C, 0x141E24, 0x17263B, 0x2E6866, 0x457F33,
- 0x37531C, 0x06000A, 0x28290B, 0x2B452A, 0x0A2E48, 0x1F3134, 0x484435, 0x112547,
- 0x001A2C, 0x865E01, 0xBF6C00, 0x7B490A, 0x3D2B1F, 0x283625, 0x5C614B, 0x3B515E,
- 0x000A37, 0x385213, 0x6C880A, 0x042325, 0x000C17, 0x01150F, 0x070F0A, 0x223C4B,
- 0x457D96, 0x4793AB, 0x0C313A, 0x000000, 0x143D4B, 0x479ABF, 0x579AB2, 0x1D3140,
- 0x076092, 0x2C8CBC, 0x274B65, 0x121F21, 0x0F0D07, 0x14320E, 0x2E270E, 0x57380B,
- 0x243F0F, 0x23290E, 0x061517, 0x000F0D, 0x1A0A07, 0x780D07, 0x5C0002, 0x000F09,
- 0x010D09, 0x030807, 0x010504, 0x000300, 0x010A0A, 0x43646B, 0x4491BE, 0x4B7068,
- 0x1D2400, 0x00110F, 0x001805, 0x082003, 0x080E07, 0x000003, 0x010708, 0x012A19,
- 0x022313, 0x073817, 0x003617, 0x12270E, 0x241E08, 0x024B16, 0x037127, 0x116122,
- 0x15601C, 0x426B19, 0x506D0C, 0x186318, 0x005424, 0x1A6425, 0x758716, 0x698211,
- 0x78890B, 0x7B6506, 0x556071, 0x456AB1, 0x3F5660, 0x445467, 0x403387, 0x3660AC,
- 0x1F66A1, 0x2E4F9B, 0x284AA4, 0x3068B1, 0x0E65A9, 0x0165B0, 0x0F66B0, 0x0568AA,
- 0x0972B3, 0x0B79B0, 0x0571AD, 0x2176A3, 0x184E8A, 0x035C9A, 0x3B90B1, 0x93D2C4,
- 0x69808D, 0x3C3063, 0x8BB9CC, 0xB2D7D6, 0xA3C4CE, 0x6C688F, 0xA4B4C0, 0xB0C8BA,
- 0xB0B6A9, 0x675145, 0x829498, 0xB1DCE4, 0x6D8673, 0x61888D, 0x5F6954, 0x3D423E,
- 0x3C506E, 0x61656A, 0x826A47, 0x443A37, 0x5E686A, 0x91926B, 0x916217, 0xD17E29,
- 0x95746B, 0xBA9338, 0xBE6320, 0xBB4E49, 0xB8645D, 0xE08441, 0xD7994C, 0xE1B76D,
- 0xC79230, 0xA76312, 0xB75343, 0xB6583B, 0x9B630D, 0x9A3800, 0xAE6854, 0xC3C2A4,
- 0x918451, 0xA5A792, 0xA7A48A, 0xBDA45E, 0xC09538, 0x968952, 0x4F5531, 0x441820,
- 0x483142, 0x1C3034, 0x3F1607, 0x4E4D66, 0x00315F, 0x030000, 0x2F3044, 0x28334C,
- 0x181E28, 0x333D4F, 0x07193F, 0x011130, 0x062249, 0xA2B0C5, 0xAEB9B9, 0x4E705A,
- 0x0E272B, 0x020100, 0x1C1929, 0x182A46, 0x041423, 0x000002, 0x000000, 0x000009,
- 0x03081C, 0x040200, 0x152B55, 0x1B2F59, 0x304F8A, 0x204B8A, 0x53599A, 0x8663A7,
- 0x4D508D, 0x4968AC, 0x414A6D, 0x181617, 0x0D0F22, 0x0F1437, 0x181A3C, 0x1B253B,
- 0x283119, 0x342603, 0x293130, 0x31355A, 0x4C2F36, 0x5C3331, 0x342721, 0x2B210B,
- 0x282726, 0x151835, 0x150E29, 0x72554A, 0x531121, 0x642605, 0xC36F0C, 0xAB4E19,
- 0x54211D, 0x20000B, 0x4B1002, 0x2A1B3A, 0x1B367F, 0x121550, 0x31194A, 0x542F42,
- 0x4E364F, 0x2E1C4F, 0x221124, 0x37396C, 0x37396C, 0x37396C, 0x37396C, 0x37396C
- };
Advertisement
Add Comment
Please, Sign In to add comment