Introduction
An infrared-receiver is a component that receives infrared signals and can independently receive infrared ray and output signals compatible with TTL level. It’s similar with a normal plastic-packaged transistor in size and it is suitable for all kinds of infrared remote control and infrared transmission.

Components
– 1 * SunFounder Uno board
– 1 * USB data cable
– 1 * Infrared-Receiver module
– 1 * Remote controller
– Several jumper wires
Experimental Principle
Control a certain key (for example, Power key) via a remote controller by programming. When you press the key, infrared rays will be emitted from the remote controller and received by the infrared receiver, and the LED on the SunFounder Uno board will light up.
Experimental Procedures
Step 1: Build the circuit
Infrared-Receiver Module SunFounder Uno
S —————————————-D2
– ————————————– GND
+ ————————————— 5V
Step 2: Program (Please refer to the example code in LEARN -> Get Tutorial on our website)
Step 3: Compile
Step 4: Upload the sketch to SunFounder Uno
Now, press Power on the remote control and the LED attached to pin 13 on the SunFounder Uno board will light up. If you press other keys, the LED will go out.

C Code
#include <IRremote.h> const int irReceiverPin = 2; const int ledPin = 13; IRrecv irrecv(irReceiverPin); decode_results results; void setup() { pinMode(ledPin,OUTPUT); Serial.begin(9600); irrecv.enableIRIn(); } void loop() { if (irrecv.decode(&results)) { Serial.print(“irCode: “); Serial.print(results.value, HEX); Serial.print(“, bits: “); Serial.println(results.bits); irrecv.resume(); } delay(600); if(results.value == 0xFFA25D) { digitalWrite(ledPin,HIGH); } else { digitalWrite(ledPin,LOW); } } |