Hello everyone, i hope your all doing great.
First of all, let me start by saying that my english is not that great.
Ok so, I have a huge problem in my tft_HX8347G, when i run the code, the text is mirrored and i have
done many researches , yet i cant find a solution, Id like you to answer as fast as possible because i have
some work to do with this tft lcd screen.
PS: im not that great at using arduino
PS2 : i tried to rotate ( from 1 to 7 ) didnt work
Here is the code im using:
#include <Adafruit_TFTLCD.h>
#include <Adafruit_GFX.h>
#include <TouchScreen.h>
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4
#define TS_MINX 122
#define TS_MINY 111
#define TS_MAXX 942
#define TS_MAXY 890
#define YP A3
#define XM A2
#define YM 9
#define XP 8
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 364);
boolean buttonEnabled = true;
void setup() {
tft.reset();
uint16_t identifier = tft.readID();
tft.begin(0x7575);
tft.setRotation(1);
tft.fillScreen(WHITE);
tft.drawRect(0,0,319,240,YELLOW);
tft.setCursor(30,40);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.print("TFT LCD Touch Screen");
tft.setCursor(115,80);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.print("Tutorial\n\n by");
tft.setCursor(30,150);
tft.setTextColor(BLUE);
tft.setTextSize(2);
tft.print("Mert Arduino and Tech");
tft.fillRect(50,180, 210, 40, RED);
tft.drawRect(50,180,210,40,BLACK);
tft.setCursor(60,190);
tft.setTextColor(WHITE);
tft.setTextSize(2);
tft.print("Please Subscribe");
}
void loop() {
TSPoint p = ts.getPoint();
if (p.z > ts.pressureThreshhold) {
p.x = map(p.x, TS_MAXX, TS_MINX, 0, 320);
p.y = map(p.y, TS_MAXY, TS_MINY, 0, 480);
if(p.x>50 && p.x<260 && p.y>180 && p.y<270 && buttonEnabled){
buttonEnabled = false;
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
tft.fillScreen(WHITE);
tft.drawRect(0,0,319,240,YELLOW);
tft.setCursor(50,70);
tft.setTextColor(BLACK);
tft.setTextSize(3);
tft.print(" Thank you\n\n for\n\n support");
}
}
}