#include <IRremote.h>
// Define the IR receiver pin
int receiverPin = 11;
// Create an instance of the IR receiver library
IRrecv irrecv(receiverPin);
// Create a variable to hold the received IR code
decode_results results;
void setup() {
// Initialize the serial communication
Serial.begin(9600);
// Enable the IR receiver
irrecv.enableIRIn();
}
void loop() {
// Check if an IR signal has been received
if (irrecv.decode(&results)) {
// Print the received IR code
Serial.println(results.value, HEX);
// Reset the IR receiver to receive the next signal
irrecv.resume();
}
}
It is NOT 38 kHz remote receiver. You must use a TSOP with the proper carrier frequency filter. The most common remotes have 38 kHz carrier, like TSOP2238 (the last 2 digits represent the frequency), or TSOP34838 (on 5 digits models, the first one is a "3" meaning it's the 3.3V version), but you can find more HERE.