/*#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>

const uint16_t kRecvPin = 14; // GPIO pin where the IR receiver is connected
IRrecv irrecv(kRecvPin);
decode_results results;

void setup() {
  Serial.begin(115200);
  irrecv.enableIRIn();  // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX); // Print the hexadecimal value of the received IR signal
    irrecv.resume(); // Receive the next value
  }
}
*/
/*#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
#include <LiquidCrystal.h>

#define PIN_IR_RECEIVER 14   // Signal Pin of IR receiver
#define PIN_LCD_RS      27   // RS pin of LCD display
#define PIN_LCD_EN      26   // Enable pin of LCD display
#define PIN_LCD_D4      25   // Data pin 4 of LCD display
#define PIN_LCD_D5      33   // Data pin 5 of LCD display
#define PIN_LCD_D6      32   // Data pin 6 of LCD display
#define PIN_LCD_D7      15   // Data pin 7 of LCD display

IRrecv irrecv(PIN_IR_RECEIVER);
decode_results results; // Define decode_results variable

LiquidCrystal lcd(PIN_LCD_RS, PIN_LCD_EN, PIN_LCD_D4, PIN_LCD_D5, PIN_LCD_D6, PIN_LCD_D7);

void setup() {
  lcd.begin(16, 2);
  lcd.print("<press a button>");
  irrecv.enableIRIn(); // Start the IR receiver
}

void loop() {
  // Checks if an IR signal has been received
  if (irrecv.decode(&results)) {
    translateIR();
     Serial.println(results.value, HEX); // Print the hexadecimal value of the received IR signal

    irrecv.resume();  // Receive the next value
  }
}

void lcdPrint(const char* text) {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("button pressed:");
  lcd.setCursor(0, 1);
  lcd.print(text);
}

void translateIR() {
  // Takes action based on the IR code received
  switch (results.command) {
    case 162:
      lcdPrint("POWER");
      break;
    case 226:
      lcdPrint("MENU");
      break;
    case 34:
      lcdPrint("TEST");
      break;
    case 2:
      lcdPrint("PLUS");
      break;
    case 194:
      lcdPrint("BACK");
      break;
    case 224:
      lcdPrint("PREV.");
      break;
    case 168:
      lcdPrint("PLAY");
      break;
    case 144:
      lcdPrint("NEXT");
      break;
    default:
      lcd.clear();
      lcd.print("Unknown button");
  }
}
*/
/*#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
#include <LiquidCrystal.h>

#define PIN_IR_RECEIVER 14   // Signal Pin of IR receiver
#define PIN_LCD_RS      27   // RS pin of LCD display
#define PIN_LCD_EN      26   // Enable pin of LCD display
#define PIN_LCD_D4      25   // Data pin 4 of LCD display
#define PIN_LCD_D5      33   // Data pin 5 of LCD display
#define PIN_LCD_D6      32   // Data pin 6 of LCD display
#define PIN_LCD_D7      15   // Data pin 7 of LCD display

IRrecv irrecv(PIN_IR_RECEIVER);
decode_results results; // Define decode_results variable

LiquidCrystal lcd(PIN_LCD_RS, PIN_LCD_EN, PIN_LCD_D4, PIN_LCD_D5, PIN_LCD_D6, PIN_LCD_D7);

void setup() {
  lcd.begin(16, 2);
  lcd.print("<press a button>");
  irrecv.enableIRIn(); // Start the IR receiver
}

void loop() {
  // Checks if an IR signal has been received
  if (irrecv.decode(&results)) {
    translateIR();
    irrecv.resume();  // Receive the next value
  }
}

void lcdPrint(const char* text, uint32_t code) {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Button pressed:");
  lcd.setCursor(0, 1);
  lcd.print(text);
  lcd.print(" Code: ");
  lcd.print(code, HEX); // Print hexadecimal code
}

void translateIR() {
  // Takes action based on the IR code received
  uint32_t code = results.value; // Store received code
  switch (code) {
    case 0xFFA25D: // Example hexadecimal code (replace with your remote's codes)
      lcdPrint("POWER", code);
      break;
    case 0xFFE21D: // Example hexadecimal code (replace with your remote's codes)
      lcdPrint("MENU", code);
      break;
    // Add more cases for other buttons with their respective hexadecimal codes
    default:
      lcd.clear();
      lcd.print("Unknown button");
      lcd.setCursor(0, 1);
      lcd.print("Code: ");
      lcd.print(code, HEX); // Print hexadecimal code of unknown button
  }
}
*/
/*
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
#include <LiquidCrystal.h>

#define PIN_IR_RECEIVER 14   // Signal Pin of IR receiver
#define PIN_LCD_RS      27   // RS pin of LCD display
#define PIN_LCD_EN      26   // Enable pin of LCD display
#define PIN_LCD_D4      25   // Data pin 4 of LCD display
#define PIN_LCD_D5      33   // Data pin 5 of LCD display
#define PIN_LCD_D6      32   // Data pin 6 of LCD display
#define PIN_LCD_D7      15   // Data pin 7 of LCD display

IRrecv irrecv(PIN_IR_RECEIVER);
decode_results results; // Define decode_results variable

LiquidCrystal lcd(PIN_LCD_RS, PIN_LCD_EN, PIN_LCD_D4, PIN_LCD_D5, PIN_LCD_D6, PIN_LCD_D7);

void setup() {
  lcd.begin(16, 2);
  lcd.print("<press a button>");
  irrecv.enableIRIn(); // Start the IR receiver
}

void loop() {
  // Checks if an IR signal has been received
  if (irrecv.decode(&results)) {
    translateIR();
    irrecv.resume();  // Receive the next value
  }
}

void lcdPrint(const char* text, uint32_t code) {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Button pressed:");
  lcd.setCursor(0, 1);
  lcd.print(text);
  lcd.print(" Code: ");
  lcd.print(code, HEX); // Print hexadecimal code
}

void translateIR() {
  // Takes action based on the IR code received
  uint32_t code = results.value; // Store received code
  switch (code) {
    case 0xFFA25D: // Example hexadecimal code (replace with your remote's codes)
      lcdPrint("POWER", code);
      break;
    case 0xFFE21D: // Example hexadecimal code (replace with your remote's codes)
      lcdPrint("MENU", code);
      break;
    // Add more cases for other buttons with their respective hexadecimal codes
    default:
      lcd.clear();
      lcd.print("Unknown button");
      lcd.setCursor(0, 1);
      lcd.print("Code: ");
      lcd.print(code, HEX); // Print hexadecimal code of unknown button
  }
}
*/
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
#include <LiquidCrystal.h>

#define PIN_IR_RECEIVER 14   // Signal Pin of IR receiver
#define PIN_LCD_RS      27   // RS pin of LCD display
#define PIN_LCD_EN      26   // Enable pin of LCD display
#define PIN_LCD_D4      25   // Data pin 4 of LCD display
#define PIN_LCD_D5      33   // Data pin 5 of LCD display
#define PIN_LCD_D6      32   // Data pin 6 of LCD display
#define PIN_LCD_D7      15   // Data pin 7 of LCD display

IRrecv irrecv(PIN_IR_RECEIVER);
decode_results results; // Define decode_results variable

LiquidCrystal lcd(PIN_LCD_RS, PIN_LCD_EN, PIN_LCD_D4, PIN_LCD_D5, PIN_LCD_D6, PIN_LCD_D7);

void setup() {
  Serial.begin(115200);
  lcd.begin(16, 2);
  lcd.print("<press a button>");
  irrecv.enableIRIn(); // Start the IR receiver
}

void loop() {
  // Checks if an IR signal has been received
  if (irrecv.decode(&results)) {
    translateIR();
    irrecv.resume();  // Receive the next value
  }
}

void lcdPrint(const char* text, uint32_t code) {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Button pressed:");
  lcd.setCursor(0, 1);
  lcd.print(text);
  lcd.print(" (0x");
  lcd.print(code, HEX); // Print hexadecimal code
  lcd.print(")");
}

void translateIR() {
  // Takes action based on the IR code received
  uint32_t code = results.value; // Store received code
  switch (results.command) {
    case 162:
      lcdPrint("POWER", code);
      break;
    case 226:
      lcdPrint("MENU", code);
      break;
    case 34:
      lcdPrint("TEST", code);
      break;
    case 2:
      lcdPrint("PLUS", code);
      break;
    case 194:
      lcdPrint("BACK", code);
      break;
    case 224:
      lcdPrint("PREV.", code);
      break;
    case 168:
      lcdPrint("PLAY", code);
      break;
    case 144:
      lcdPrint("NEXT", code);
      break;
    default:
      lcd.clear();
      lcd.print("Unknown button");
  }
}
esp:0
esp:2
esp:4
esp:5
esp:12
esp:13
esp:14
esp:15
esp:16
esp:17
esp:18
esp:19
esp:21
esp:22
esp:23
esp:25
esp:26
esp:27
esp:32
esp:33
esp:34
esp:35
esp:3V3
esp:EN
esp:VP
esp:VN
esp:GND.1
esp:D2
esp:D3
esp:CMD
esp:5V
esp:GND.2
esp:TX
esp:RX
esp:GND.3
esp:D1
esp:D0
esp:CLK
ir1:GND
ir1:VCC
ir1:DAT
lcd1:VSS
lcd1:VDD
lcd1:V0
lcd1:RS
lcd1:RW
lcd1:E
lcd1:D0
lcd1:D1
lcd1:D2
lcd1:D3
lcd1:D4
lcd1:D5
lcd1:D6
lcd1:D7
lcd1:A
lcd1:K