i want to get the keypad press are displayed in adafruit 2.8" tft touch screen
#include "TFTLCD.h"
#include <Keypad.h>
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] =
{
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
byte rowPins[ROWS] = {44, 45, 46,47 };//ect to the row pinouts of the keypad
byte colPins[COLS] = {48,49,50};//the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(void)
{
Serial.begin(9600);
Serial.println("8 Bit LCD test!");
tft.reset();
tft.initDisplay();
tft.fillScreen(BLACK);
}
void loop(void)
{
testdrawrects(RED);
delay(1000);
char key = keypad.getKey();
if (key)
{
Serial.println(key);
}
}
void testdrawrects(uint16_t color)
{
tft.fillScreen(WHITE);
int h1=260;
int w1=90;
int h2=40;
int w2=40;
tft.drawRect(tft.width() -w1 , tft.height() -h1, 82 , 62, RED);
tft.fillRect(tft.width()-w1 , tft.height() -h1 , 80, 60, YELLOW);
tft.drawRect(tft.width() -2*w2, tft.height() -2*h2, 62 , 52, RED);
tft.fillRect(tft.width() -2*w2, tft.height() -2*h2 , 60, 50, YELLOW);
tft.setCursor(40, 40);
tft.setTextColor(color);
tft.setTextSize(2);
tft.println(keypad.getKey());
}