PROGRAM
/*
An IR detector/demodulator must be connected to the input RECV_PIN.
*/
#include <IRremote.h>
int b;
int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
while(!irrecv.decode(&results)) ;
{
irrecv.resume(); // Receive the next value
}
if(results.value==33441975){ Serial.println(“off”);}
if(results.value==0X1FE50AF)//1
{
digitalWrite(10,HIGH);
}
else if(results.value==0X1FED827)//2
{
digitalWrite(9,HIGH);
}
else if(results.value==0X1FE30CF)//4
{
digitalWrite(10,LOW);
}
else if(results.value==0X1FEB04F)//5
{
digitalWrite(9,LOW);
}
}