Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * NeoPixel Test Sketch 2
- * 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 leds3[NUM_LEDS];
- CRGB leds4[NUM_LEDS];
- uint8_t gBrightness = 128;
- void setup() {
- Serial.begin(9600); // open the serial port at 9600 bps:
- FastLED.addLeds<WS2812, 3>(leds2, NUM_LEDS); // Binary 2 position
- FastLED.addLeds<WS2812, 4>(leds1, NUM_LEDS); // Binary 1 position
- FastLED.addLeds<WS2812, 5>(leds3, NUM_LEDS); // Binary 4 position
- FastLED.addLeds<WS2812, 6>(leds4, NUM_LEDS); // Binary 8 position
- }
- void loop()
- {
- FastLED.clear();
- void redLeds();
- Serial.println("beginning of void loop");
- void greenLeds();
- void blueLeds();
- void whiteLeds();
- void magentaLeds();
- void cyanLeds();
- void yellowLeds();
- void purpleLeds();
- Serial.println("end of void loop");
- }
- void redLeds()
- {
- Serial.println("redLeds function");
- for (int i = 0; i < NUM_LEDS; i++)
- {
- // 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);
- }
- void greenLeds()
- {
- Serial.println("greenLeds function");
- 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);
- }
- void blueLeds()
- {
- Serial.println("blueLeds function");
- for (int i = 0; i < NUM_LEDS; i++)
- {
- // set our current dot to Blue
- leds3[i] = CRGB::Blue;
- FastLED.show(gBrightness);
- // clear our current dot before we move on
- leds3[i] = CRGB::Black;
- delay(100);
- }
- // draw led data for the third strand into leds
- fill_solid(leds3, NUM_LEDS, CRGB::Blue);
- FastLED[2].showLeds(gBrightness);
- delay(500);
- }
- void whiteLeds()
- {
- Serial.println("whiteLeds function");
- for (int i = 0; i < NUM_LEDS; i++)
- {
- // set our current dot to White
- leds4[i] = CRGB::White;
- FastLED.show(gBrightness);
- // clear our current dot before we move on
- leds4[i] = CRGB::Black;
- delay(100);
- }
- // draw led data for the fourth strand into leds
- fill_solid(leds4, NUM_LEDS, CRGB::White);
- FastLED[3].showLeds(gBrightness);
- delay(500);
- }
- void magentaLeds()
- {
- Serial.println("MagentaLeds function");
- for (int i = 0; i < NUM_LEDS; i++)
- {
- // 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);
- }
- void cyanLeds()
- {
- Serial.println("CyanLeds function");
- 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);
- }
- void yellowLeds()
- {
- Serial.println("YellowLeds function");
- for (int i = 0; i < NUM_LEDS; i++)
- {
- // set our current dot to Yellow
- leds3[i] = CRGB::Yellow;
- FastLED.show(gBrightness);
- // clear our current dot before we move on
- leds3[i] = CRGB::Black;
- delay(100);
- }
- // draw led data for the third strand into leds
- fill_solid(leds3, NUM_LEDS, CRGB::Yellow);
- FastLED[2].showLeds(gBrightness);
- delay(500);
- }
- void purpleLeds()
- {
- Serial.println("PurpleLeds function");
- for (int i = 0; i < NUM_LEDS; i++)
- {
- // set our current dot to Purple
- leds4[i] = CRGB::Purple;
- FastLED.show(gBrightness);
- // clear our current dot before we move on
- leds4[i] = CRGB::Black;
- delay(100);
- }
- // draw led data for the fourth strand into leds
- fill_solid(leds4, NUM_LEDS, CRGB::Purple);
- FastLED[3].showLeds(gBrightness);
- delay(500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement