Intent; future when completed the 44-button remote will provide colors and different patterns.
I already have some patterns of leds done and they do well by themselfs with a call by pressing one of the DIY remote buttons. So how do I add a common delay to any of these?
I thought adding "int d = 50;" inside the CASE statement for SLOW would work but I get the following error; error: crosses initialization of ‘int d’
All and any comments welcomed.
#include "IRremote.h"
#include <Adafruit_NeoPixel.h>
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(150, PIN, NEO_GRB + NEO_KHZ800);
int r =0;
int x = 0;
int d = 1;
int b = 0;
int pos = 0, dir = 1;
int j = 0;
int m = 0;
int TOTAL_LEDS = 150;
int direction=1;
int receiver = 3;
IRrecv irrecv(receiver);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
Serial.println("IR Receiver Raw Data + Button Decode Test");
}
void loop()
{
if (irrecv.decode(&results))
{
irrecv.resume();
}
switch(results.value)
{
case 0xFF3AC5:
Serial.println("Brightness Down");// lowest brightness level
strip.setBrightness(35);
strip.begin();
strip.show();
break;
case 0xFFBA45:
Serial.println("Brightness Up");// mid-brightness level
strip.setBrightness(110);
strip.begin();
strip.show();
break;
case 0xFF827D:
Serial.println("Play");// high brightness level
strip.setBrightness(240);
strip.begin();
strip.show();
break;
case 0xFF02FD:
Serial.println("Power");
BLACK();
/*
Can not use strip.setBrightness(0)
as this value of 0 the strip will not restart but a value of 1 does start
and with "1" the strip is not completely OFF
*/
break;
case 0xFF28D7:
Serial.println("Red Arrow UP");
break;
case 0xFFA857:
Serial.println("Green Arrow UP");
break;
case 0xFF6897:
Serial.println("Blue Arrow UP");
break;
case 0xFFE817:
Serial.println("QUICK");
break;
case 0xFF08F7:
Serial.println("Red Arrow Down");
break;
case 0xFF8877:
Serial.println("Green Arrow Down");
break;
case 0xFF48B7:
Serial.println("Blue Arrow Down");
break;
case 0xFFC837:
Serial.println("SLOW");
int d = 50;
break;
case 0xFF30CF:
Serial.println("DIY 1");
DIY1();
break;
case 0xFFB04F:
Serial.println("DIY 2");
DIY2();
break;
case 0xFF708F:
Serial.println("DIY 3");
break;
case 0xFFF00F:
Serial.println("AUTO");
break;
case 0xFF10EF:
Serial.println("DIY 4");
DIY4();
break;
case 0xFF906F:
Serial.println("DIY 5");
DIY5();
break;
case 0xFF50AF:
Serial.println("DIY 6");
DIY6();
break;
default:
Serial.println(" other button ");
}
delay(100); // original value 500
}
void DIY1()
{
int b = 75;
strip.begin();
strip.show();
strip.setBrightness(100);
// does stuff
delay(d);
}
void DIY2()
{
strip.begin();
strip.show();
strip.setBrightness(100);
// does stuff
delay(d);
}
void DIY4()
{
strip.begin();
strip.show();
strip.setBrightness(100);
// does stuff
delay(d);
}
void DIY5()
{
strip.begin();
strip.show();
strip.setBrightness(100);
// does stuff
delay(d);
}
void DIY6()
{
strip.begin();
strip.show();
strip.setBrightness(100);
// does stuff
delay(d);
}
void BLACK()
{
strip.begin();
strip.show();
for (int ledNumber=0; ledNumber<TOTAL_LEDS; ledNumber++)
{
strip.setPixelColor(ledNumber, 0,0,0);
}
}