IR Remote Demo

Remote Control LED Operation

The following was used to test the function of the IR remote kit, ST071.

It uses a Funduino Uno (M009) to decode the infrared transmissions and light red, yellow and green leds in response only to presses of keys 1, 2 and 3 respectively on the remote control keypad. A press on the key marked CH turns off any lit led.

The circuit arrangement is as shown below:

Sample code:

#include <IRremote.h>
const int RECV_PIN = 8; //IR input pin
const int RED = 13; // Red led output
const int YELLOW = 12; // Yellow led output
const int GREEN = 11; // Green led output
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
    pinMode(RED, OUTPUT);
    pinMode(YELLOW, OUTPUT);
    pinMode(GREEN, OUTPUT);
    irrecv.enableIRIn(); // Start the receiver

void loop()
    if (irrecv.decode(&results))
        Serial.println(results.value, HEX); //show code received.

            case 0xFF30CF:  //hex code key 1
                digitalWrite(RED, HIGH); //light RED
            case 0xFF18E7:  //hex code key 2
                digitalWrite(YELLOW, HIGH);  //light YELLOW
            case 0xFF7A85:  //hex code key 3  //light GREEN
                digitalWrite(GREEN, HIGH);
            case 0xFF629D:  //hex code key CH
                digitalWrite(RED, LOW); //turn all off
                digitalWrite(YELLOW, LOW);
                digitalWrite(GREEN, LOW);
    irrecv.resume(); // Receive the next value  

Your IP Address is:
Copyright © 2021 Bitsbox. Powered by Zen Cart