#include <IRremote.h>
const int RECV_PIN = 2; // Chân mà bộ thu IR được kết nối
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
Serial.begin(9600); // Khởi động giao tiếp Serial
irrecv.enableIRIn(); // Khởi động bộ thu IR
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value); // In giá trị nhận được dưới dạng HEX
irrecv.resume(); // Tiếp tục nhận tín hiệu tiếp theo
}
}