/* flash 3 Pixel LED strips randomly version 2
www. steamtraininfo.com.
This sketch uses 3
WS2812B pixel strips.
*/
#include <FastLED.h>
#define NUM_LEDS 15 /*the number of leds that will light. If */
//****************************
#define DATA_PINA 8 // Connect to the data wires on the pixel strips
#define DATA_PINB 7
#define DATA_PINC 6
CRGB ledsA[NUM_LEDS]; // sets number of pixels that will light on each strip.
CRGB ledsB[NUM_LEDS];
CRGB ledsC[NUM_LEDS];
//*****************************************************
void setup() {
FastLED.addLeds<WS2812B, DATA_PINA, GRB>(ledsA, NUM_LEDS);
FastLED.addLeds<WS2812B, DATA_PINB, GRB>(ledsB, NUM_LEDS);
FastLED.addLeds<WS2812B, DATA_PINC, GRB>(ledsC, NUM_LEDS);
randomSeed(analogRead(A0)); /*sets the pin to create "static so the the initial LED to light is different
each time through the loop */
}
//********************************************************
void loop() {
BlinkRandomly();
}
//**************************************************
void fillStrip(int number, const struct CRGB &color) {
switch (number) {
case 1:
fill_solid(ledsA, NUM_LEDS, color);
break;
case 2:
fill_solid(ledsB, NUM_LEDS, color);
break;
case 3:
fill_solid(ledsC, NUM_LEDS, color);
break;
}
FastLED.show();
}
//**************************************************
void BlinkRandomly() {
int delayTime = random(25, 200); // sets the blink rate in milliseconds
int stripIndex = random(1, 4);
fillStrip(stripIndex, CRGB::Red);
delay(delayTime);
fillStrip(stripIndex, CRGB::Black);
delay(delayTime);
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
neopixels1:DOUT
neopixels1:VDD
neopixels1:VSS
neopixels1:DIN
neopixels2:DOUT
neopixels2:VDD
neopixels2:VSS
neopixels2:DIN
neopixels3:DOUT
neopixels3:VDD
neopixels3:VSS
neopixels3:DIN