#include <IRremoteESP8266.h>
#include <WiFi.h> // For Wi-Fi control (optional)
#define WIFI_SSID "Wokwi-GUEST"
#define WIFI_PASSWORD ""
const int RECV_PIN = D2; // IR receiver pin
const int SEND_PIN = D1; // IR emitter pin
IRsend irsend(SEND_PIN);
void setup() {
Serial.begin(115200);
pinMode(RECV_PIN, INPUT);
IrReceiver.begin(RECV_PIN, ENABLE_IR_INVERSE); // Initialize IR receiver
// WiFi setup (optional)
}
void loop() {
if (IrReceiver.decode()) {
Serial.println(IrReceiver.decodedIRData.hex); // Print received IR code
// Replace this with your code to send the received code or process it
irsend.sendNEC(IrReceiver.decodedIRData.hex, 32); // Send the code as NEC format
IrReceiver.resume(); // Receive the next value
}
}