November 27, 2017

Weekday Arduino Project #2

Decode IR Remote Buttons

The Project:
Decode the signals from an IR remote to use in other projects.

Pictures:

Why?:
For later projects, and to decode any of your IR remotes for later usability.

What you need:
  1. Arduino Uno Board
  2. 3 pin IR receiver
  3. IR remote
  4. Breadboard
  5. Arduino software

The Schematic:

The Code:
// Include all needed libraries
#include <IRLib.h>
#include <IRLibMatch.h>
#include <IRLibRData.h>
#include <IRLibTimer.h>

// Create a receiver object to listen on pin 11
IRrecv My_Receiver(6);

// Create a decoder object
IRdecode My_Decoder;

void setup()
{
  Serial.begin(9600);
  My_Receiver.enableIRIn();   // Start the receiver
}

void loop() {
// Continuously look for results. When you have them pass them to the decoder
  if (My_Receiver.GetResults(&My_Decoder)) {
    My_Decoder.decode();   // Decode the data
    My_Decoder.DumpResults(); // Show the results on serial monitor
    My_Receiver.resume(); // Restart the receiver
  }

}

The Library:
Feel free to contact me if you have any questions!


No comments:

Post a Comment