INFRARED CODE READING

Code IR

#include <IRremote.h>

int RECV_PIN = 3;

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

}

}

OR IN DECIMAL

#include <IRremote.h>

int RECV_PIN = 3;

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, DEC);

irrecv.resume(); // Receive the next value

}

}

OTHER SKET

#include <IRLib.h>

//Create a receiver object to listen on pin 3

IRrecv My_Receiver(3);

//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

}

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s