To control (3LED) ON/OFF using Remote control & Arduino uno, IR receiver
Code:
#include <IRremote.h>
const byte IR_RECEIVE_PIN = 11;
#define LED1 2
#define LED2 3
#define LED3 4
void setup()
{
Serial.begin(115200);
Serial.println(“IR Receive test”);
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
}
// ██████ ███████ ██ ███████ ███████ ██████ ██████ ███ ███ //██ ████ ██ ██ ██ ██ ██ ██ ██ ████ ████ //██ ██ ██ ███████ ██ █████ █████ ██ ██ ██ ██ ████ ██ //████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ // ██████ ███████ ██ ███████ ██ ██ ██████ ██████ ██ ██
void loop()
{
if (IrReceiver.decode())
{
String ir_code = String(IrReceiver.decodedIRData.command, HEX);
Serial.println(ir_code);
if(ir_code == “45”)
digitalWrite(LED1, HIGH);
else if(ir_code == “44”)
digitalWrite(LED1, LOW);
if(ir_code == “46”)
digitalWrite(LED2, HIGH);
else if(ir_code == “40”)
digitalWrite(LED2, LOW);
if(ir_code == “47”)
digitalWrite(LED3, HIGH);
else if(ir_code == “43”)
digitalWrite(LED3, LOW);
IrReceiver.resume();
}
}
// ▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄ ▄▄ // ▐░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░▌ ▐░░▌ //▐░█░█▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░▌░▌ ▐░▐░▌ //▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌▐░▌ ▐░▌▐░▌ //▐░▌ ▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▐░▌ ▐░▌ //▐░▌ ▐░▌ ▐░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ //▐░▌ ▐░▌ ▐░▌ ▀▀▀▀▀▀▀▀▀█░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌ ▐░▌▐░▌ ▀ ▐░▌ //▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ //▐░█▄▄▄▄▄█░█░▌ ▄▄▄▄▄▄▄▄▄█░▌ ▄▄▄▄█░█▄▄▄▄ ▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▄ ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ // ▐░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌ // ▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
osief.com
An IR (Infrared) receiver is an electronic component used to detect and decode infrared signals sent by IR remote controls or other IR transmitters. It’s commonly used in various electronic devices to enable remote control functionality. The IR receiver module typically consists of an IR sensor, signal processing circuitry, and an output pin.
Here’s a brief overview of how an IR receiver works and how to use it:
Components of an IR Receiver:
- IR Sensor: The core of the IR receiver is an IR sensor that is sensitive to infrared light. When an IR remote control sends a command, it modulates an infrared signal at a specific frequency. The IR sensor detects this modulated signal.
- Signal Processing Circuitry: The IR receiver includes circuitry to demodulate and decode the received signal. This circuitry typically filters out noise and extracts the data encoded in the IR signal.
- Output Pin: The IR receiver has an output pin that provides the decoded data as electrical signals to a microcontroller or other digital circuit for further processing.
0sief