Hello again,
I need help with my code again using the Neopixel with a remote. So far everything works but after a while my IR signals don't come in anymore. It varies from not working at all to working for a while and then it comes to a complete stop. I switched remotes thinking it would make a difference. But it didn't. For those who are wondering I first used a Car MP 3 remote and now I am using a Sony DVD RMT-D247P Remote. The remotes are not the problem I think... Maybe the problem lies within my code? I am not good at this at all I hope you guys can help me out.. if the code is not the problem I may have to order a new IR receiver.
Here is the code:
#include <Adafruit_NeoPixel.h>
#include <IRLibAll.h>
IRrecv myReceiver(2);//receiver on pin 2
IRdecode myDecoder;//Decoder object
//One NeoPixel connected to pin 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(24,6,NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
myReceiver.enableIRIn(); // Start the receiver
}
void loop() {
if (myReceiver.getResults()) {
myDecoder.decode();
if (myDecoder.protocolNum ==SONY) {
switch(myDecoder.value) {
case 0xA8B5F: //On/Off Button
for(int i=0; i<24; i++) // This part of the code adds how many LEDs should be turned on (0, R, G, B)
{
strip.setPixelColor(i, 0, 0, 0); //Turns the light off
}
break;
case 0xB5F: //Button 1
for(int i=0; i<24; i++) // This part of the code adds how many LEDs should be turned on
{
strip.setPixelColor(i, 255, 255, 255); //White
}
break;
case 0x80B5F: //Button 2
for(int i=0; i<24; i++)
{
strip.setPixelColor(i, 255, 103, 23);//Warm White
}
break;
case 0x40B5F: //Button 3
for(int i=0; i<24; i++)
{
strip.setPixelColor(i, 0,0, 255);//Blue
}
break;
case 0xC0B5F: //Button 4
for(int i=0; i<24; i++)
{
strip.setPixelColor(i, 0, 255, 255);//Cyan
}
break;
case 0x20B5F: //Button 5
for(int i=0; i<24; i++)
{
strip.setPixelColor(i, 255, 255, 0);//Yellow
}
break;
case 0xA0B5F: //Button 6
for(int i=0; i<24; i++)
{
strip.setPixelColor(i, 255, 69,0);//Orange
}
break;
case 0x60B5F: //Button 7
for(int i=0; i<24; i++)
{
strip.setPixelColor(i, 255, 20, 147);//Pink
}
break;
case 0xE0B5F: //Button 8
for(int i=0; i<24; i++)
{
strip.setPixelColor(i, 128, 0, 128);//Magenta
}
break;
case 0x10B5F: //Button 9
for(int i=0; i<24; i++)
{
strip.setPixelColor(i, 75, 0, 130);//Purple
}
break;
case 0x90B5F: //Button 0
for(int i=0; i<24; i++)
{
strip.setPixelColor(i, 50, 205, 50);//Lime Green
}
}
strip.show();
myReceiver.enableIRIn(); //Restart the receiver
}
}
}
I hope I can get help fast