#include <IRremote.h>
int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop(){
if(irrecv.decode(&results)){ //1 is turn led on
Serial.println(results.value, HEX);
switch(results.value){
case 0xFD08F7:
digitalWrite(13, HIGH);
break;
case 0xFD48B7:
digitalWrite(12, HIGH);
break;
case 0xFD8877:
digitalWrite(13, LOW); // Red Dot is Off
break;
case 0xFD28D7:
digitalWrite(12, LOW);
break;
}
irrecv.resume();
}
delay(100);
}
int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop(){
if(irrecv.decode(&results)){ //1 is turn led on
Serial.println(results.value, HEX);
switch(results.value){
case 0xFD08F7:
digitalWrite(13, HIGH);
break;
case 0xFD48B7:
digitalWrite(12, HIGH);
break;
case 0xFD8877:
digitalWrite(13, LOW); // Red Dot is Off
break;
case 0xFD28D7:
digitalWrite(12, LOW);
break;
}
irrecv.resume();
}
delay(100);
}
How to control your Leds using remote control and IR sensor
In this tutorial, I will show you a few steps you should follow to control your led using a remote control and Arduino Uno
Comments
Please log in or sign up to comment.