Figure 1 – Keyes IR Receiver Module
Specifications
· Supply Voltage: 2.7V to 5.5V
· Supply Current : 1.5mA
· Operating Temperature: -25°C to 85°C
· Frequency: 37.9KHZ
· Receiving Angle: 90°
· Receiving Distance: 18m
Figure 2 – Schematic of Keyes IR Receiver Module
Figure 3 – The Circuit of Remote Control with IR Receıver Module Of ARDUINO
You can read The TV Control Buttons (Figure 4) Code on Serial Monitor (Figure 5).
Figure 4 – TV Control
Figure 5 - The TV Control Buttons Codes on Serial Monitor
Arduino UNO Program
#include<IRremote.h>
// Library of IR Remote
int RECV_PIN
= 8; // Arduino Pin Number for IR Receiver Data Pin
IRrecv
irrecv(RECV_PIN);
decode_results
results;
#define LED1
4
#define LED2
5
#define LED3
6
#define LED4
7
void setup()
{
Serial.begin(9600); //
Serial Bound Rate
irrecv.enableIRIn(); //
Start the receiver
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
}
void loop()
{
if (irrecv.decode(&results)) {
uint32_t resultCode = (results.value );
if (resultCode==0x20DF8877)// TV Control Button “1” Code
{
digitalWrite(LED1,HIGH); //LED1 ON
}
else if (resultCode==0x20DF48B7)// TV Control Button “2” Code
{
digitalWrite(LED2,HIGH); //LED2 ON
}
else if (resultCode==0x20DFC837)// TV Control Button “3” Code
{
digitalWrite(LED3,HIGH); //LED3 ON
}
else if (resultCode==0x20DF28D7)// TV Control Button “4” Code
{
digitalWrite(LED4,HIGH); //LED4 ON
}
else if (resultCode==0x20DF08F7)// TV Control Button “0” Code
{
digitalWrite(LED1,LOW); //LED1 OFF
digitalWrite(LED2,LOW); //LED2 OFF
digitalWrite(LED3,LOW); //LED3 OFF
digitalWrite(LED4,LOW); //LED4 OFF
}
Serial.println(results.value, HEX); //Write the button code to serial monitor
irrecv.resume(); //
Receive the next value
}
}
Click for the Arduino Program (IR_LEDKontrol.ino)
Click for the IRremote Library (IRremote.h)
Click for the Arduino Program (IR_LEDKontrol.ino)
Click for the IRremote Library (IRremote.h)
Video Of Lesson
Hiç yorum yok:
Yorum Gönder