// HAZI TECH
// Programmed by Hasitha Jayasundara
// Visit my YouTube Channel - http://www.youtube.com/c/HAZITECH?sub_confirmation=1
#include "Arduino.h"
#include "FastLED.h"
#define DATA_PIN 5
#define LED_TYPE WS2812
#define COLOR_ORDER GRB
#define NUM_LEDS 60 //Total no of LEDs (Maximum 500 LEDs - Use multiplications of 5 : Eg.5,10,15,....50,55,60,....500)
CRGB leds[NUM_LEDS];
int SPEED1 = 50;
int SPEED2 = 20;
int SPEED3 = 30;
void setup()
{
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.setBrightness(255);
}
void loop()
{
// theatherChase - Color (red, green, blue), speed delay
theaterChase(0,0,255,SPEED1);
theaterChaseR(0,0,255,SPEED1);
theaterChase(255,255,0,SPEED1);
theaterChaseR(255,255,0,SPEED1);
theaterChase(255,0,0,SPEED1);
theaterChaseR(255,0,0,SPEED1);
theaterChase(255,255,255,SPEED1);
theaterChaseR(255,255,255,SPEED1);
theaterChase(255,165,0,SPEED1);
theaterChaseR(255,165,0,SPEED1);
// theaterChaseRainbow - Speed delay
theaterChaseRainbow(SPEED1);
theaterChaseRainbowR(SPEED1);
RunningLights(0,0,255,SPEED3);
RunningLightsR(0,0,255,SPEED3);
Sparkle(0,0,255, 0);
RunningLights(255,255,0,SPEED3);
RunningLightsR(255,255,0,SPEED3);
Sparkle(255,255,0, 0);
RunningLights(255,0,0,SPEED3);
RunningLightsR(255,0,0,SPEED3);
Sparkle(255,0,0, 0);
RunningLights(255,255,255,SPEED3);
RunningLightsR(255,255,255,SPEED3);
Sparkle(255,255,255, 0);
RunningLights(255,165,0,SPEED3);
RunningLightsR(255,165,0,SPEED3);
Sparkle(255,165,0, 0);
// meteorRain - Color (red, green, blue), meteor size, trail decay, random trail decay (true/false), speed delay
meteorRain(0,0,255,10, 64, true, SPEED2);
meteorRainR(255,255,0,10, 64, true, SPEED2);
meteorRain(255,0,0,10, 64, true, SPEED2);
meteorRainR(255,255,255,10, 64, true, SPEED2);
meteorRain(255,165,0,10, 64, true, SPEED2);
Flag_Flow();
Flag_Flow();
Fade_Full();
Flag();
Flag();
Flag();
Full_Fill();
Flag_Fill_Segments_1();
Flag_Fill_Segments_2();
Flag_Fill_Segments_3();
Flag_Fill();
Flag_Fill();
Flag_Runner_1();
Flag_Runner_1();
Flag_Runner_1();
Flag_Runner_2();
Flag_Runner_2();
Flag_Runner_3();
Flag_Runner_3();
Flag_Runner_3();
Flag_Runner_3();
Flag_Runner_3();
}
void theaterChase(byte red, byte green, byte blue, int SpeedDelay) {
for (int j=0; j<10; j++) { //do 10 cycles of chasing
for (int q=0; q < 3; q++) {
for (int i=0; i < NUM_LEDS; i=i+3) {
setPixel(i+q, red, green, blue); //turn every third pixel on
}
showStrip();
delay(SpeedDelay);
for (int i=0; i < NUM_LEDS; i=i+3) {
setPixel(i+q, 0,0,0); //turn every third pixel off
}
}
}
}
void theaterChaseR(byte red, byte green, byte blue, int SpeedDelay) {
for (int j=0; j<10; j++) { //do 10 cycles of chasing
for (int q=0; q < 3; q++) {
for (int i=NUM_LEDS; i > 0; i=i-3) {
setPixel(i-q, red, green, blue); //turn every third pixel on
}
showStrip();
delay(SpeedDelay);
for (int i=NUM_LEDS; i > 0; i=i-3) {
setPixel(i-q, 0,0,0); //turn every third pixel off
}
}
}
}
void theaterChaseRainbow(int SpeedDelay) {
byte *c;
for (int j=0; j < 256; j++) { // cycle all 256 colors in the wheel
for (int q=0; q < 3; q++) {
for (int i=0; i < NUM_LEDS; i=i+3) {
c = Wheel( (i+j) % 255);
setPixel(i+q, *c, *(c+1), *(c+2)); //turn every third pixel on
}
showStrip();
delay(SpeedDelay);
for (int i=0; i < NUM_LEDS; i=i+3) {
setPixel(i+q, 0,0,0); //turn every third pixel off
}
}
}
}
void theaterChaseRainbowR(int SpeedDelay) {
byte *c;
for (int j=0; j < 256; j++) { // cycle all 256 colors in the wheel
for (int q=0; q < 3; q++) {
for (int i=NUM_LEDS; i > 0; i=i-3) {
c = Wheel( (i+j) % 255);
setPixel(i-q, *c, *(c+1), *(c+2)); //turn every third pixel on
}
showStrip();
delay(SpeedDelay);
for (int i=NUM_LEDS; i > 0; i=i-3) {
setPixel(i-q, 0,0,0); //turn every third pixel off
}
}
}
}
void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {
setAll(0,0,0);
for(int i = 0; i < NUM_LEDS+NUM_LEDS; i++) {
// fade brightness all LEDs one step
for(int j=0; j<NUM_LEDS; j++) {
if( (!meteorRandomDecay) || (random(10)>5) ) {
fadeToBlack(j, meteorTrailDecay );
}
}
// draw meteor
for(int j = 0; j < meteorSize; j++) {
if( ( i-j <NUM_LEDS) && (i-j>=0) ) {
setPixel(i-j, red, green, blue);
}
}
showStrip();
delay(SpeedDelay);
}
}
void meteorRainR(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {
setAll(0,0,0);
for(int i = NUM_LEDS+NUM_LEDS; i > 0; i--) {
// fade brightness all LEDs one step
for(int j=NUM_LEDS; j>0; j--) {
if( (!meteorRandomDecay) || (random(10)>5) ) {
fadeToBlack(j, meteorTrailDecay );
}
}
// draw meteor
for(int j = 0; j < meteorSize; j++) {
if( ( i-j <NUM_LEDS) && (i-j>=0) ) {
setPixel(i-j, red, green, blue);
}
}
showStrip();
delay(SpeedDelay);
}
}
void RunningLights(byte red, byte green, byte blue, int WaveDelay) {
int Position=0;
for(int j=0; j<NUM_LEDS*2; j++)
{
Position++; // = 0; //Position + Rate;
for(int i=0; i<NUM_LEDS; i++) {
// sine wave, 3 offset waves make a rainbow!
//float level = sin(i+Position) * 127 + 128;
//setPixel(i,level,0,0);
//float level = sin(i+Position) * 127 + 128;
setPixel(i,((sin(i+Position) * 127 + 128)/255)*red,
((sin(i+Position) * 127 + 128)/255)*green,
((sin(i+Position) * 127 + 128)/255)*blue);
}
showStrip();
delay(WaveDelay);
}
}
void RunningLightsR(byte red, byte green, byte blue, int WaveDelay) {
int Position=0;
for(int j=0; j<NUM_LEDS*2; j++)
{
Position++; // = 0; //Position + Rate;
for(int i=NUM_LEDS; i>0; i--) {
// sine wave, 3 offset waves make a rainbow!
//float level = sin(i+Position) * 127 + 128;
//setPixel(i,level,0,0);
//float level = sin(i+Position) * 127 + 128;
setPixel(i,((sin(i-Position) * 127 + 128)/255)*red,
((sin(i-Position) * 127 + 128)/255)*green,
((sin(i-Position) * 127 + 128)/255)*blue);
}
showStrip();
delay(WaveDelay);
}
}
void Sparkle(byte red, byte green, byte blue, int SpeedDelay)
{
for (int i = 0; i < 500; i++)
{
int Pixel = random(NUM_LEDS);
setPixel(Pixel,red,green,blue);
showStrip();
delay(SpeedDelay);
setPixel(Pixel,0,0,0);
}
delay (10);
}
void Flag_Flow()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(0*(NUM_LEDS/5))] = CRGB::Blue;
FastLED.show();
delay (10);
}
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(1*(NUM_LEDS/5))] = CRGB::Yellow;
FastLED.show();
delay (10);
}
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(2*(NUM_LEDS/5))] = CRGB::Red;
FastLED.show();
delay (10);
}
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(3*(NUM_LEDS/5))] = CRGB::White;
FastLED.show();
delay (10);
}
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(4*(NUM_LEDS/5))] = CRGB::Orange;
FastLED.show();
delay (10);
}
delay (500);
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay (10);
}
delay (500);
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[(5*(NUM_LEDS/5)-1)-i] = CRGB::Orange;
FastLED.show();
delay (10);
}
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[(4*(NUM_LEDS/5)-1)-i] = CRGB::White;
FastLED.show();
delay (10);
}
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[(3*(NUM_LEDS/5)-1)-i] = CRGB::Red;
FastLED.show();
delay (10);
}
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[(2*(NUM_LEDS/5)-1)-i] = CRGB::Yellow;
FastLED.show();
delay (10);
}
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[(1*(NUM_LEDS/5)-1)-i] = CRGB::Blue;
FastLED.show();
delay (10);
}
delay (500);
for (int i = (NUM_LEDS-1); i >= 0; i--)
{
leds[i] = CRGB::Black;
FastLED.show();
delay (10);
}
delay (500);
}
void Fade_Full()
{
for (int j = 0; j <= 255; j++)
{
fill_solid(leds, NUM_LEDS, CRGB::Blue);
FastLED.setBrightness(j);
FastLED.show();
delay (3);
}
for (int j = 255; j >= 0; j--)
{
fill_solid(leds, NUM_LEDS, CRGB::Blue);
FastLED.setBrightness(j);
FastLED.show();
delay (3);
}
for (int j = 0; j <= 255; j++)
{
fill_solid(leds, NUM_LEDS, CRGB::Yellow);
FastLED.setBrightness(j);
FastLED.show();
delay (3);
}
for (int j = 255; j >= 0; j--)
{
fill_solid(leds, NUM_LEDS, CRGB::Yellow);
FastLED.setBrightness(j);
FastLED.show();
delay (3);
}
for (int j = 0; j <= 255; j++)
{
fill_solid(leds, NUM_LEDS, CRGB::Red);
FastLED.setBrightness(j);
FastLED.show();
delay (3);
}
for (int j = 255; j >= 0; j--)
{
fill_solid(leds, NUM_LEDS, CRGB::Red);
FastLED.setBrightness(j);
FastLED.show();
delay (3);
}
for (int j = 0; j <= 255; j++)
{
fill_solid(leds, NUM_LEDS, CRGB::White);
FastLED.setBrightness(j);
FastLED.show();
delay (3);
}
for (int j = 255; j >= 0; j--)
{
fill_solid(leds, NUM_LEDS, CRGB::White);
FastLED.setBrightness(j);
FastLED.show();
delay (3);
}
for (int j = 0; j <= 255; j++)
{
fill_solid(leds, NUM_LEDS, CRGB::Orange);
FastLED.setBrightness(j);
FastLED.show();
delay (3);
}
for (int j = 255; j >= 0; j--)
{
fill_solid(leds, NUM_LEDS, CRGB::Orange);
FastLED.setBrightness(j);
FastLED.show();
delay (3);
}
FastLED.setBrightness(255);
}
void Flag()
{
for (int j = 0; j <= 255; j++)
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(0*(NUM_LEDS/5))] = CRGB::Blue;
leds[i+(1*(NUM_LEDS/5))] = CRGB::Yellow;
leds[i+(2*(NUM_LEDS/5))] = CRGB::Red;
leds[i+(3*(NUM_LEDS/5))] = CRGB::White;
leds[i+(4*(NUM_LEDS/5))] = CRGB::Orange;
}
FastLED.setBrightness(j);
FastLED.show();
delay (3);
}
for (int j = 255; j >= 0; j--)
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(0*(NUM_LEDS/5))] = CRGB::Blue;
leds[i+(1*(NUM_LEDS/5))] = CRGB::Yellow;
leds[i+(2*(NUM_LEDS/5))] = CRGB::Red;
leds[i+(3*(NUM_LEDS/5))] = CRGB::White;
leds[i+(4*(NUM_LEDS/5))] = CRGB::Orange;
}
FastLED.setBrightness(j);
FastLED.show();
delay (3);
}
FastLED.setBrightness(255);
}
void Full_Fill()
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB::Blue;
FastLED.show();
delay (10);
}
delay (500);
for (int i = NUM_LEDS-1; i >= 0; i--)
{
leds[i] = CRGB::Yellow;
FastLED.show();
delay (10);
}
delay (500);
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay (10);
}
delay (500);
for (int i = NUM_LEDS-1; i >= 0; i--)
{
leds[i] = CRGB::White;
FastLED.show();
delay (10);
}
delay (500);
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB::Orange;
FastLED.show();
delay (10);
}
delay (500);
for (int i = NUM_LEDS-1; i >= 0; i--)
{
leds[i] = CRGB::White;
FastLED.show();
delay (10);
}
delay (500);
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay (10);
}
delay (500);
for (int i = NUM_LEDS-1; i >= 0; i--)
{
leds[i] = CRGB::Yellow;
FastLED.show();
delay (10);
}
delay (500);
}
void Flag_Fill_Segments_1()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(0*(NUM_LEDS/5))] = CRGB::Blue;
leds[i+(1*(NUM_LEDS/5))] = CRGB::Yellow;
leds[i+(2*(NUM_LEDS/5))] = CRGB::Red;
leds[i+(3*(NUM_LEDS/5))] = CRGB::White;
leds[i+(4*(NUM_LEDS/5))] = CRGB::Orange;
FastLED.show();
delay (50);
}
delay (500);
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(0*(NUM_LEDS/5))] = CRGB::Black;
leds[i+(1*(NUM_LEDS/5))] = CRGB::Black;
leds[i+(2*(NUM_LEDS/5))] = CRGB::Black;
leds[i+(3*(NUM_LEDS/5))] = CRGB::Black;
leds[i+(4*(NUM_LEDS/5))] = CRGB::Black;
FastLED.show();
delay (50);
}
delay (500);
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[(5*(NUM_LEDS/5)-1)-i] = CRGB::Orange;
leds[(4*(NUM_LEDS/5)-1)-i] = CRGB::White;
leds[(3*(NUM_LEDS/5)-1)-i] = CRGB::Red;
leds[(2*(NUM_LEDS/5)-1)-i] = CRGB::Yellow;
leds[(1*(NUM_LEDS/5)-1)-i] = CRGB::Blue;
FastLED.show();
delay (50);
}
delay (500);
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[(5*(NUM_LEDS/5)-1)-i] = CRGB::Black;
leds[(4*(NUM_LEDS/5)-1)-i] = CRGB::Black;
leds[(3*(NUM_LEDS/5)-1)-i] = CRGB::Black;
leds[(2*(NUM_LEDS/5)-1)-i] = CRGB::Black;
leds[(1*(NUM_LEDS/5)-1)-i] = CRGB::Black;
FastLED.show();
delay (50);
}
delay (500);
}
void Flag_Fill_Segments_2()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(0*(NUM_LEDS/5))] = CRGB::Blue;
leds[i+(1*(NUM_LEDS/5))] = CRGB::Yellow;
leds[i+(2*(NUM_LEDS/5))] = CRGB::Red;
leds[i+(3*(NUM_LEDS/5))] = CRGB::White;
leds[i+(4*(NUM_LEDS/5))] = CRGB::Orange;
FastLED.show();
delay (50);
}
delay (500);
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[(5*(NUM_LEDS/5)-1)-i] = CRGB::Black;
leds[(4*(NUM_LEDS/5)-1)-i] = CRGB::Black;
leds[(3*(NUM_LEDS/5)-1)-i] = CRGB::Black;
leds[(2*(NUM_LEDS/5)-1)-i] = CRGB::Black;
leds[(1*(NUM_LEDS/5)-1)-i] = CRGB::Black;
FastLED.show();
delay (50);
}
delay (500);
}
void Flag_Fill_Segments_3()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[(5*(NUM_LEDS/5)-1)-i] = CRGB::Orange;
leds[(4*(NUM_LEDS/5)-1)-i] = CRGB::White;
leds[(3*(NUM_LEDS/5)-1)-i] = CRGB::Red;
leds[(2*(NUM_LEDS/5)-1)-i] = CRGB::Yellow;
leds[(1*(NUM_LEDS/5)-1)-i] = CRGB::Blue;
FastLED.show();
delay (50);
}
delay (500);
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(0*(NUM_LEDS/5))] = CRGB::Black;
leds[i+(1*(NUM_LEDS/5))] = CRGB::Black;
leds[i+(2*(NUM_LEDS/5))] = CRGB::Black;
leds[i+(3*(NUM_LEDS/5))] = CRGB::Black;
leds[i+(4*(NUM_LEDS/5))] = CRGB::Black;
FastLED.show();
delay (50);
}
delay (500);
}
void Flag_Fill()
{
for (int i = 0; i < 5*(NUM_LEDS/5); i++)
{
leds[i] = CRGB::Orange;
FastLED.show();
delay (20);
}
for (int i = 0; i < 4*(NUM_LEDS/5); i++)
{
leds[i] = CRGB::White;
FastLED.show();
delay (20);
}
for (int i = 0; i < 3*(NUM_LEDS/5); i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay (20);
}
for (int i = 0; i < 2*(NUM_LEDS/5); i++)
{
leds[i] = CRGB::Yellow;
FastLED.show();
delay (20);
}
for (int i = 0; i < 1*(NUM_LEDS/5); i++)
{
leds[i] = CRGB::Blue;
FastLED.show();
delay (20);
}
delay (1000);
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(0*(NUM_LEDS/5))] = CRGB::Black;
leds[i+(1*(NUM_LEDS/5))] = CRGB::Black;
leds[i+(2*(NUM_LEDS/5))] = CRGB::Black;
leds[i+(3*(NUM_LEDS/5))] = CRGB::Black;
leds[i+(4*(NUM_LEDS/5))] = CRGB::Black;
FastLED.show();
delay (50);
}
delay (500);
for (int i = NUM_LEDS; i >= 0*(NUM_LEDS/5); i--)
{
leds[i] = CRGB::Blue;
FastLED.show();
delay (20);
}
for (int i = NUM_LEDS; i >= 1*(NUM_LEDS/5); i--)
{
leds[i] = CRGB::Yellow;
FastLED.show();
delay (20);
}
for (int i = NUM_LEDS; i >= 2*(NUM_LEDS/5); i--)
{
leds[i] = CRGB::Red;
FastLED.show();
delay (20);
}
for (int i = NUM_LEDS; i >= 3*(NUM_LEDS/5); i--)
{
leds[i] = CRGB::White;
FastLED.show();
delay (20);
}
for (int i = NUM_LEDS; i >= 4*(NUM_LEDS/5); i--)
{
leds[i] = CRGB::Orange;
FastLED.show();
delay (20);
}
delay (1000);
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[(5*(NUM_LEDS/5)-1)-i] = CRGB::Black;
leds[(4*(NUM_LEDS/5)-1)-i] = CRGB::Black;
leds[(3*(NUM_LEDS/5)-1)-i] = CRGB::Black;
leds[(2*(NUM_LEDS/5)-1)-i] = CRGB::Black;
leds[(1*(NUM_LEDS/5)-1)-i] = CRGB::Black;
FastLED.show();
delay (50);
}
delay (500);
}
void Flag_Runner_1 ()
{
Blue ();
delay (200);
FastLED.clear();
Yellow ();
delay (200);
FastLED.clear();
Red ();
delay (200);
FastLED.clear();
White ();
delay (200);
FastLED.clear();
Orange ();
delay (200);
FastLED.clear();
White ();
delay (200);
FastLED.clear();
Red ();
delay (200);
FastLED.clear();
Yellow ();
delay (200);
FastLED.clear();
}
void Flag_Runner_2 ()
{
Blue ();
delay (200);
Yellow ();
delay (200);
Red ();
delay (200);
White ();
delay (200);
Orange ();
delay (200);
Orange_OFF ();
delay (200);
White_OFF ();
delay (200);
Red_OFF ();
delay (200);
Yellow_OFF ();
delay (200);
Blue_OFF ();
delay (200);
Orange ();
delay (200);
White ();
delay (200);
Red ();
delay (200);
Yellow ();
delay (200);
Blue ();
delay (200);
Blue_OFF ();
delay (200);
Yellow_OFF ();
delay (200);
Red_OFF ();
delay (200);
White_OFF ();
delay (200);
Orange_OFF ();
delay (200);
}
void Flag_Runner_3 ()
{
Yellow_OFF ();
White_OFF ();
Blue ();
Red ();
Orange ();
delay (200);
Blue_OFF ();
Red_OFF ();
Orange_OFF ();
Yellow ();
White ();
delay (200);
}
void Blue ()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(0*(NUM_LEDS/5))] = CRGB::Blue;
}
FastLED.show();
}
void Blue_OFF ()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(0*(NUM_LEDS/5))] = CRGB::Black;
}
FastLED.show();
}
void Yellow ()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(1*(NUM_LEDS/5))] = CRGB::Yellow;
}
FastLED.show();
}
void Yellow_OFF ()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(1*(NUM_LEDS/5))] = CRGB::Black;
}
FastLED.show();
}
void Red ()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(2*(NUM_LEDS/5))] = CRGB::Red;
}
FastLED.show();
}
void Red_OFF ()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(2*(NUM_LEDS/5))] = CRGB::Black;
}
FastLED.show();
}
void White ()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(3*(NUM_LEDS/5))] = CRGB::White;
}
FastLED.show();
}
void White_OFF ()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(3*(NUM_LEDS/5))] = CRGB::Black;
}
FastLED.show();
}
void Orange ()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(4*(NUM_LEDS/5))] = CRGB::Orange;
}
FastLED.show();
}
void Orange_OFF ()
{
for (int i = 0; i < (NUM_LEDS/5); i++)
{
leds[i+(4*(NUM_LEDS/5))] = CRGB::Black;
}
FastLED.show();
}
// Apply LED color changes
void showStrip() {
#ifdef ADAFRUIT_NEOPIXEL_H
// NeoPixel
strip.show();
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
// FastLED
FastLED.show();
#endif
}
// Set a LED color (not yet visible)
void setPixel(int Pixel, byte red, byte green, byte blue) {
#ifdef ADAFRUIT_NEOPIXEL_H
// NeoPixel
strip.setPixelColor(Pixel, strip.Color(red, green, blue));
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
// FastLED
leds[Pixel].r = red;
leds[Pixel].g = green;
leds[Pixel].b = blue;
#endif
}
// Set all LEDs to a given color and apply it (visible)
void setAll(byte red, byte green, byte blue) {
for(int i = 0; i < NUM_LEDS; i++ ) {
setPixel(i, red, green, blue);
}
showStrip();
}
// used by rainbowCycle and theaterChaseRainbow
byte * Wheel(byte WheelPos) {
static byte c[3];
if(WheelPos < 85) {
c[0]=WheelPos * 3;
c[1]=255 - WheelPos * 3;
c[2]=0;
} else if(WheelPos < 170) {
WheelPos -= 85;
c[0]=255 - WheelPos * 3;
c[1]=0;
c[2]=WheelPos * 3;
} else {
WheelPos -= 170;
c[0]=0;
c[1]=WheelPos * 3;
c[2]=255 - WheelPos * 3;
}
return c;
}
// used by meteorrain
void fadeToBlack(int ledNo, byte fadeValue) {
#ifdef ADAFRUIT_NEOPIXEL_H
// NeoPixel
uint32_t oldColor;
uint8_t r, g, b;
int value;
oldColor = strip.getPixelColor(ledNo);
r = (oldColor & 0x00ff0000UL) >> 16;
g = (oldColor & 0x0000ff00UL) >> 8;
b = (oldColor & 0x000000ffUL);
r=(r<=10)? 0 : (int) r-(r*fadeValue/256);
g=(g<=10)? 0 : (int) g-(g*fadeValue/256);
b=(b<=10)? 0 : (int) b-(b*fadeValue/256);
strip.setPixelColor(ledNo, r,g,b);
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
// FastLED
leds[ledNo].fadeToBlackBy( fadeValue );
#endif
}