Project6.Digital IR Receiver
Description
IR is widely used in remote control. With this IR receiver, Arduino project is able to receive command from any IR remoter controllers if you have the right decoder. Well, it will be also easy to make your own IR controller using IR transmitter.
Specification
Power Supply: 5V
Interface: Digital
Modulation Frequency: 38Khz
Module Interface Socket: JST PH2.0
Size: 30*20mm
Weight: 4g
Connect
Code
#include <IRremote.h>
IRsend irsend;
void setup()
{}
void loop() {
irsend.sendRC5(0x0, 8); //send 0x0 code (8 bits)
delay(200);
irsend.sendRC5(0x1, 8);
delay(200); }
Note
Upload this code to the transmitter
#include <IRremote.h>
const int RECV_PIN = 11;
const int LED_PIN = 13;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop()
{if (irrecv.decode(&results))
{ if ( results.bits > 0 )
{
int state;
if ( 0x1 == results.value )
{
state = HIGH;
}
else
{
state = LOW;
}
digitalWrite( LED_PIN, state );
}
irrecv.resume(); // prepare to receive the next value
}
}
Note
Upload this code to the receiver
When IR Receiver module receives the infrared signal from IR Transmitter, D1 led on the IR Receiver module will blink. When IR Receiver module receives the infrared signal from IR Transmitter, D1 led on the IR Receiver module will blink.
Phenomenon