Example Code for Arduino-IR Receiver Test
Last revision 2026/01/24
This guide offers sample code and detailed instructions for testing IR receivers with Arduino, covering hardware setup, wiring diagrams, and software preparation using the IRremote library for efficient IR signal reception.
Software Preparation
IR Remote Library Includes some sample codes for sending and receiving.
Wiring Diagram
The following image shows a suggested connection method. You may use any Digital I/O pin that is not in use by another device.

Other Preparation Work
NOTE:In the sample code below Digital pin 11 is in use, you may either change your wiring or change the sample code to match.
Sample Code
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
}
Was this article helpful?
