Howdy,
when "tlc.init()" line is not commented in setup() function, I can't read IR codes. I had the IR pin on 2, 5, 7 but same result. Any ideeas why?
Here is my code:
#include <WProgram.h>
#include <NECIRrcv.h>
#include "Tlc5940.h"
#define IRPIN 5 // IR receiver pin
NECIRrcv ir(IRPIN) ;
void setup()
{
Serial.begin(9600) ;
Serial.println("NEC IR code reception") ;
ir.begin() ;
Tlc.init();
}
void loop()
{
while (ir.available()) Read_IR_Code(ir.read());
}
void Read_IR_Code(unsigned long IR_Code)
{
switch (IR_Code)
{
case 4228116224: // ON button
f_ON();
break;
case 4244827904: // OFF button
f_OFF();
break;
case 4261539584: // Dimm - button
f_DIMM_Minus();
break;
case 4278251264: // Dimm + button
f_DIMM_Plus();
break;
case 4161269504: // W button
f_W();
break;
case 4177981184: // B button
f_B();
break;
case 4194692864: // G button
f_G();
case 4211404544: // R button
f_B();
break;
case 4094422784: // Flash button
f_Flash();
break;
case 4027576064: // Strobe button
f_Strobe();
break;
case 3960729344: // Fade button
f_Fade();
break;
case 3893882624: // Smooth button
f_Smooth();
break;
case 4144557824: // Red colour button
f_Red_Colour();
break;
case 4127846144: // Green colour button
f_Green_Colour();
break;
case 4111134464: // Blue colour button
f_Blue_Colour();
break;
case 4077711104: // User (1,1) colour button
f_User_1_1();
break;
case 4060999424: // User (1,2) colour button
f_User_1_2();
break;
case 4044287744: // User (1,3) colour button
f_User_1_3();
break;
case 4010864384: // User (2,1) colour button
f_User_2_1();
break;
case 3994152704: // User (2,2) colour button
f_User_2_2();
break;
case 3977441024: // User (2,3) colour button
f_User_2_3();
break;
case 3944017664: // User (3,1) colour button
f_User_3_1();
break;
case 3927305984: // User (3,2) colour button
f_User_3_2();
break;
case 3910594304: // User (3,3) colour button
f_User_3_3();
break;
}
}
void f_ON()
{
Serial.println("ON");
}
void f_OFF()
{
Serial.println("OFF");
}
void f_DIMM_Minus()
{
Serial.println("Dimm -");
}
void f_DIMM_Plus()
{
Serial.println("Dimm +");
}
void f_W()
{
Serial.println("W");
}
void f_B()
{
Serial.println("B");
}
void f_G()
{
Serial.println("G");
}
void f_R()
{
Serial.println("R");
}
void f_Flash()
{
Serial.println("Flash");
}
void f_Strobe()
{
Serial.println("Strobe");
}
void f_Fade()
{
Serial.println("Fade");
}
void f_Smooth()
{
Serial.println("Smooth");
}
void f_Red_Colour()
{
Serial.println("Red colour");
}
void f_Green_Colour()
{
Serial.println("Green colour");
}
void f_Blue_Colour()
{
Serial.println("Blue colour");
}
void f_User_1_1()
{
Serial.println("User 1,1");
}
void f_User_1_2()
{
Serial.println("User 1,2");
}
void f_User_1_3()
{
Serial.println("User 1,3");
}
void f_User_2_1()
{
Serial.println("User 2,1");
}
void f_User_2_2()
{
Serial.println("User 2,2");
}
void f_User_2_3()
{
Serial.println("User 2,3");
}
void f_User_3_1()
{
Serial.println("User 3,1");
}
void f_User_3_2()
{
Serial.println("User 3,2");
}
void f_User_3_3()
{
Serial.println("User 3,3");
}