I use the IRremote (or the later IRlib) library with my remote projects. A Multi-Protocol Infrared Remote Library for the Arduino The library has examples to help understand how the remotes encode data. I don't know what that code is trying to accomplish, but using the library you can get consistent usable data from the remote and if your goal is to control devices via IR from the Arduino the libraries will make it less difficult.
That creates an instance (variable) of the IRrecv class called irrecv. That is called a constructor. Male sure that the value of RECV_PIN is the number of the input pin connected to your decoder.
one this that is still stumping me is the fact that your arduino compiler wont compile that line : IRrecv irrecv(RECV_PIN);
says "IRrecv does not name a type"
im using this example from the IR library:
im using a mega 2560 if that makes any difference.
/*
* 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
}
}
if i run that and press the power button i get the garbage from my previous post
Do you have any data on the IR decoder (receiver)? The ones that I have worked with invert the data before sending the data to the arduino and the library expects that. I have to wonder if yours doesn't invert so confuses the library. I am out of ideas otherwise.