#include <IRremote.h>
int led =12;
int led2 = 3;
int signal = 7;
void setup() {
Serial.begin(9600);
IrReceiver.begin(7);
pinMode(12, OUTPUT);
pinMode(3, OUTPUT);
// put your setup code here, to run once:
}
void loop() {
if (IrReceiver.decode())
{
Serial.println(IrReceiver.decodedIRData.command);
IrReceiver.resume();
}
else if(IrReceiver.decodedIRData.command == 48)
{
Serial.println("You pressed Button 1");
digitalWrite(led, HIGH);
digitalWrite(led2, LOW);
delay(1000);
}
else if(IrReceiver.decodedIRData.command == 24)
{
Serial.println("You pressed Button 2");
digitalWrite(led, LOW);
digitalWrite(led2, HIGH);
delay(1000);
}
else if(IrReceiver.decodedIRData.command == 122)
{
Serial.println("You pressed Button 3");
digitalWrite(led, LOW);
digitalWrite(led2, LOW);
delay(1000);
}
else if(IrReceiver.decodedIRData.command == 16)
{
Serial.println("You pressed Button 4");
digitalWrite(led, HIGH);
digitalWrite(led2, HIGH);
delay(1000);
}
else if(IrReceiver.decodedIRData.command == 56)
{
Serial.println("You pressed Button 5");
digitalWrite(led, LOW);
digitalWrite(led2, LOW);
delay(1000);
}
else if(IrReceiver.decodedIRData.command == 90)
{
Serial.println("You pressed Button 6");
digitalWrite(led, LOW);
digitalWrite(led2, LOW);
delay(1000);
}
else if(IrReceiver.decodedIRData.command == 66)
{
Serial.println("You pressed Button 7");
digitalWrite(led, LOW);
digitalWrite(led2, LOW);
delay(1000);
}
else if(IrReceiver.decodedIRData.command == 74)
{
Serial.println("You pressed Button 8");
digitalWrite(led, LOW);
digitalWrite(led2, LOW);
delay(1000);
}
else if(IrReceiver.decodedIRData.command == 82)
{
Serial.println("You pressed Button 9");
digitalWrite(led, LOW);
digitalWrite(led2, LOW);
delay(1000);
}
//else if(IrReceiver.decodedIRData.command == )
//{
//Serial.println("You pressed another button");
//delay(100);
//}
else
{
Serial.println("No button was pressed");
digitalWrite(led, LOW);
digitalWrite(led2, LOW);
delay(1000);
}
// put your main code here, to run repeatedly:
}