/*
ESP32 HTTPClient Jokes API Example
https://wokwi.com/projects/342032431249883731
Copyright (C) 2022, Uri Shaked
*/
#include <HTTPClient.h>
#include <ArduinoJson.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include "IRremote.hpp"
#define BTN_PIN 5
#define TFT_DC 2
#define TFT_CS 15
const int irReceiverPin = 13;
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup() {
pinMode(BTN_PIN, INPUT_PULLUP);
tft.begin();
tft.setRotation(1);
tft.setTextColor(ILI9341_WHITE);
tft.setTextSize(2);
IrReceiver.begin(irReceiverPin , ENABLE_LED_FEEDBACK);
}
void loop() {
if (digitalRead(BTN_PIN) == LOW) {
tft.fillScreen(ILI9341_BLACK);
tft.setCursor(0, 0);
}
if (IrReceiver.decode()) {
IrReceiver.printIRResultShort(&Serial);
uint16_t command = IrReceiver.decodedIRData.command;
//tft.println(command);
switch(command)
{
case 162:
tft.fillScreen(ILI9341_BLACK);
tft.println("On/off");
break;
case 34:
tft.fillScreen(ILI9341_BLACK);
tft.println("Test");
break;
case 226:
tft.fillScreen(ILI9341_BLACK);
tft.println("Menu");
break;
case 168:
tft.fillScreen(ILI9341_BLACK);
tft.println("Play");
break;
default:
tft.fillScreen(ILI9341_BLACK);
tft.println("Error");
break;
}
IrReceiver.resume();
}
delay(100);
}