Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- NeoPixel Test Sketch 1
- Testing NeoPixel sketches
- To be used in a small kaleidoscope binary clock
- */
- #include "FastLED.h"
- #define NUM_LEDS 4
- CRGB leds1[NUM_LEDS];
- CRGB leds2[NUM_LEDS];
- CRGB leds4[NUM_LEDS];
- CRGB leds8[NUM_LEDS];
- uint8_t gBrightness = 128;
- void setup()
- {
- FastLED.addLeds<WS2812, 3>(leds1, NUM_LEDS); // Binary 2 position
- FastLED.addLeds<WS2812, 4>(leds2, NUM_LEDS); // Binary 1 position
- FastLED.addLeds<WS2812, 5>(leds4, NUM_LEDS); // Binary 4 position
- FastLED.addLeds<WS2812, 6>(leds8, NUM_LEDS); // Binary 8 position
- }
- void loop()
- {
- for (int i = 0; i < NUM_LEDS; i++)
- {
- FastLED.clear();
- // set our current dot to red
- leds1[i] = CRGB::Red;
- FastLED.show(gBrightness);
- // clear our current dot before we move on
- leds1[i] = CRGB::Black;
- delay(100);
- }
- // draw led data for the first strand into leds
- fill_solid(leds1, NUM_LEDS, CRGB::Red);
- FastLED[1].showLeds(gBrightness);
- delay(500);
- for (int i = 0; i < NUM_LEDS; i++)
- {
- // set our current dot to Green
- leds2[i] = CRGB::Green;
- FastLED.show(gBrightness);
- // clear our current dot before we move on
- leds2[i] = CRGB::Black;
- delay(100);
- }
- // draw led data for the second strand into leds
- fill_solid(leds2, NUM_LEDS, CRGB::Green);
- FastLED[0].showLeds(gBrightness);
- delay(500);
- for (int i = 0; i < NUM_LEDS; i++)
- {
- // set our current dot to Blue
- leds4[i] = CRGB::Blue;
- FastLED.show(gBrightness);
- // clear our current dot before we move on
- leds4[i] = CRGB::Black;
- delay(100);
- }
- // draw led data for the third strand into leds
- fill_solid(leds4, NUM_LEDS, CRGB::Blue);
- FastLED[2].showLeds(gBrightness);
- delay(500);
- for (int i = 0; i < NUM_LEDS; i++)
- {
- // set our current dot to White
- leds8[i] = CRGB::White;
- FastLED.show(gBrightness);
- // clear our current dot before we move on
- leds8[i] = CRGB::Black;
- delay(100);
- }
- // draw led data for the fourth strand into leds
- fill_solid(leds8, NUM_LEDS, CRGB::White);
- FastLED[3].showLeds(gBrightness);
- delay(500);
- FastLED.clear();
- for (int i = 0; i < NUM_LEDS; i++)
- {
- FastLED.clear();
- // set our current dot to Magenta
- leds1[i] = CRGB::Magenta;
- FastLED.show(gBrightness);
- // clear our current dot before we move on
- leds1[i] = CRGB::Black;
- delay(100);
- }
- // draw led data for the first strand into leds
- fill_solid(leds1, NUM_LEDS, CRGB::Magenta);
- FastLED[1].showLeds(gBrightness);
- delay(500);
- for (int i = 0; i < NUM_LEDS; i++)
- {
- // set our current dot to Cyan
- leds2[i] = CRGB::Cyan;
- FastLED.show(gBrightness);
- // clear our current dot before we move on
- leds2[i] = CRGB::Black;
- delay(100);
- }
- // draw led data for the second strand into leds
- fill_solid(leds2, NUM_LEDS, CRGB::Cyan);
- FastLED[0].showLeds(gBrightness);
- delay(500);
- for (int i = 0; i < NUM_LEDS; i++)
- {
- // set our current dot to Yellow
- leds4[i] = CRGB::Yellow;
- FastLED.show(gBrightness);
- // clear our current dot before we move on
- leds4[i] = CRGB::Black;
- delay(100);
- }
- // draw led data for the third strand into leds
- fill_solid(leds4, NUM_LEDS, CRGB::Yellow);
- FastLED[2].showLeds(gBrightness);
- delay(500);
- for (int i = 0; i < NUM_LEDS; i++)
- {
- // set our current dot to Purple
- leds8[i] = CRGB::Purple;
- FastLED.show(gBrightness);
- // clear our current dot before we move on
- leds8[i] = CRGB::Black;
- delay(100);
- }
- // draw led data for the fourth strand into leds
- fill_solid(leds8, NUM_LEDS, CRGB::Purple);
- FastLED[3].showLeds(gBrightness);
- delay(1000);
- FastLED.clear();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement