#include <Keypad.h>
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC 2
#define TFT_CS 15
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
const uint8_t ROWS = 4;
const uint8_t COLS = 4;
char keys[ROWS][COLS] = {
{ '1', '2', '3', 'A' },
{ '4', '5', '6', 'B' },
{ '7', '8', '9', 'C' },
{ '*', '0', '#', 'D' }
};
uint8_t colPins[COLS] = { 26, 25, 33, 32 }; // Pins connected to C1, C2, C3, C4
uint8_t rowPins[ROWS] = { 13, 12, 14, 27 }; // Pins connected to R1, R2, R3, R4
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup() {
tft.begin();
tft.drawRect(0, 0, 240, 64, ILI9341_WHITE);
tft.drawRect(0, 64, 60, 64, ILI9341_WHITE);
tft.drawRect(60, 64, 60, 64, ILI9341_WHITE);
tft.drawRect(120, 64, 60, 64, ILI9341_WHITE);
tft.drawRect(180, 64, 60, 64, ILI9341_WHITE);
tft.drawRect(0, 128, 60, 64, ILI9341_WHITE);
tft.drawRect(60, 128, 60, 64, ILI9341_WHITE);
tft.drawRect(120, 128, 60, 64, ILI9341_WHITE);
tft.drawRect(180, 128, 60, 64, ILI9341_WHITE);
tft.drawRect(0, 192, 60, 64, ILI9341_WHITE);
tft.drawRect(60, 192, 60, 64, ILI9341_WHITE);
tft.drawRect(120, 192, 60, 64, ILI9341_WHITE);
tft.drawRect(180, 192, 60, 64, ILI9341_WHITE);
tft.drawRect(0, 256, 60, 64, ILI9341_WHITE);
tft.drawRect(60, 256, 60, 64, ILI9341_WHITE);
tft.drawRect(120, 256, 60, 64, ILI9341_WHITE);
tft.drawRect(180, 256, 60, 64, ILI9341_WHITE);
tft.setCursor(3, 20);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(3);
tft.println("Valores");
tft.setCursor(20, 85);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("1");
tft.setCursor(20, 149);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("4");
tft.setCursor(20, 213);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("7");
tft.setCursor(20, 277);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println(",");
tft.setCursor(80, 85);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("2");
tft.setCursor(80, 149);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("5");
tft.setCursor(80, 213);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("8");
tft.setCursor(80, 277);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("0");
tft.setCursor(140, 85);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("3");
tft.setCursor(140, 149);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("6");
tft.setCursor(140, 213);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("9");
tft.setCursor(140, 277);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("=");
tft.setCursor(200, 85);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("+");
tft.setCursor(200, 149);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("-");
tft.setCursor(200, 213);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("*");
tft.setCursor(200, 277);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println("/");
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}