#include <IRremote.h>
const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;
unsigned long key_value = 0;
void setup(){
Serial.begin(9600);
irrecv.enableIRIn();
irrecv.blink13(true);
}
void loop(){
if (irrecv.decode(&results)){
if (results.value == 0XFFFFFFFF)
results.value = key_value;
switch(results.value){
case 0xFFA25D:
Serial.println("CH-");
break;
case 0xFF629D:
Serial.println("CH");
break;
case 0xFFE21D:
Serial.println("CH+");
break;
case 0xFF22DD:
Serial.println("|<<");
break;
case 0xFF02FD:
Serial.println(">>|");
break ;
case 0xFFC23D:
Serial.println(">|");
break ;
case 0xFFE01F:
Serial.println("-");
break ;
case 0xFFA857:
Serial.println("+");
break ;
case 0xFF906F:
Serial.println("EQ");
break ;
case 0xFF6897:
Serial.println("0");
break ;
case 0xFF9867:
Serial.println("100+");
break ;
case 0xFFB04F:
Serial.println("200+");
break ;
case 0xFF30CF:
Serial.println("1");
break ;
case 0xFF18E7:
Serial.println("2");
break ;
case 0xFF7A85:
Serial.println("3");
break ;
case 0xFF10EF:
Serial.println("4");
break ;
case 0xFF38C7:
Serial.println("5");
break ;
case 0xFF5AA5:
Serial.println("6");
break ;
case 0xFF42BD:
Serial.println("7");
break ;
case 0xFF4AB5:
Serial.println("8");
break ;
case 0xFF52AD:
Serial.println("9");
break ;
}
key_value = results.value;
irrecv.resume();
}
}
So my code is not working because of this proplem
aIR Receiver enabled. Press buttons on your remote.
**************************************************************************************************
Thank you for using the IRremote library!
It seems, that you are using a old version 2.0 code / example.
This version is no longer supported!
Please use one of the new code examples from the library,
available at "File > Examples > Examples from Custom Libraries / IRremote".
Or downgrade your library to version 2.6.0.
Start with the SimpleReceiver or SimpleSender example.
The examples are documented here:
https://github.com/Arduino-IRremote/Arduino-IRremote#examples-for-this-library
A guide how to convert your 2.0 program is here:
https://github.com/Arduino-IRremote/Arduino-IRremote#converting-your-2x-program-to-the-4x-version
Thanks
**************************************************************************************************
why is this happening I tryed to upgrade to IRremote.h latest version but still not working !
More details such as what controller. Is it known for sure the controller works. Look at the emitting LED with your phone camera, do you get a white dot when a button is pressed? Post a simple annotated schematic showing exactly how it was wired, including all connections, power, grounds and power sources.
If I say my neighbor got a new car and ask what color is it what would you answer. Similar thing here. Please supply the rest of the information requested. Why, several of my remotes have both IR and RF, telling me the receiver LED lights indicates that the battery in the remote is probably OK. There are several coding and modulation setups used in a wide range of remote controllers what do you have. Please realize we cannot see what you have, you have to tell us.
#include <IRremote.h>
int RECV_PIN = 7; // Define the pin where the IR receiver's OUT pin is connected
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
Serial.begin(9600); // Initialize serial communication for debugging
irrecv.enableIRIn(); // Start the IR receiver
Serial.println("IR Receiver enabled. Press buttons on your remote.");
}
void loop() {
if (irrecv.decode(&results)) { // Check if an IR signal is received and decoded
Serial.print("Received IR Code: ");
Serial.println(results.value, HEX); // Print the decoded value in hexadecimal format
irrecv.resume(); // Enable the receiver to receive the next value
}
}
You code is for old library version. Get the code from (new) library examples.
See the difference, new syntax is IrReceiver.
#include <IRremote.hpp>
#define IR_RECEIVE_PIN 2
void setup()
{
Serial.begin(115200); // // Establish serial communication
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); // Start the receiver
}
void loop() {
if (IrReceiver.decode()) {
Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX); // Print "old" raw data
IrReceiver.printIRResultShort(&Serial); // Print complete received data in one line
IrReceiver.printIRSendUsage(&Serial); // Print the statement required to send this data
...
IrReceiver.resume(); // Enable receiving of the next value
}
}
Start here. If you are using a newer version of this library, it should be
#include <IRremote.hpp>
There are a number of changes you might need to make to update that sketch to the new library version, or you could use the older one as the error message you posted said.