having trouble with tft lcd + ultrasonic sensor!!!! (arduino uno 3)

Dear arduino forum members,

i’m really stuck with my project. I would like to use a ultrasonic sensor( HC-SR04) to measure water tank level.

these are the hardware inf:

arduino uno
tft lcd 2.8" 240x320
HC-SR04

here is my code:

#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);

const int VCC = 13;
const int trigPin = 11;
const int echoPin = 12;

long duration = 0;
long distance = 0;
long distanceOld = 0;

void setup(void){

tft.reset();
uint16_t identifier = tft.readID();
tft.begin(identifier);

tft.fillScreen(BLACK);
tft.setTextWrap(true);

pinMode(VCC, OUTPUT);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
digitalWrite(VCC, HIGH); // +5V - Pin 13 as VCC

tft.setTextSize(2);
tft.setTextColor(YELLOW);
tft.setCursor(5,15);
tft.print(“testing”);

tft.setTextSize(2);
tft.setTextColor(RED);
tft.setCursor(10,290);
tft.print(“test!”);
}

void loop(){
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034/2;

if(distance!=distanceOld){
getDistance(distanceOld, BLACK);
getDistance(distance, WHITE);
}

distanceOld = distance;
delay(1000);
}

void getDistance(long distance, int color){

int x;
if(distance < 10 ) x=41;
else if((distance < 100) || (distance >= 1000)) x=28;
else x=19;

tft.setCursor(x, 135);
tft.setTextColor(color);
tft.setTextSize(6);

if(distance < 1000) {
tft.print(distance);
tft.print(" cm");
}
else {
tft.print("…");
}
}

and this is error i have…

C:\Users\Jung Sun Kim\Documents\Arduino\libraries\Adafruit_TFTLCD\Adafruit_TFTLCD.cpp:815:0: warning: “read8” redefined

#define read8(x) x=read8fn()

^

In file included from C:\Users\Jung Sun Kim\Documents\Arduino\libraries\Adafruit_TFTLCD\Adafruit_TFTLCD.cpp:20:0:

C:\Users\Jung Sun Kim\Documents\Arduino\libraries\Adafruit_TFTLCD\pin_magic_UNO.h:82:0: note: this is the location of the previous definition

#define read8 read8inline

^

C:\Users\Jung Sun Kim\Documents\Arduino\libraries\Adafruit_TFTLCD\Adafruit_TFTLCD.cpp: In member function ‘void Adafruit_TFTLCD::begin(uint16_t)’:

C:\Users\Jung Sun Kim\Documents\Arduino\libraries\Adafruit_TFTLCD\pin_magic_UNO.h:111:19: warning: large integer implicitly truncated to unsigned type [-Woverflow]

hi = (d) >> 8; lo = (d); CD_DATA ; write8(hi); write8(lo); }

^

C:\Users\Jung Sun Kim\Documents\Arduino\libraries\Adafruit_TFTLCD\pin_magic_UNO.h:86:25: note: in expansion of macro ‘writeRegister16inline’

#define writeRegister16 writeRegister16inline

^

C:\Users\Jung Sun Kim\Documents\Arduino\libraries\Adafruit_TFTLCD\Adafruit_TFTLCD.cpp:290:5: note: in expansion of macro ‘writeRegister16’

writeRegister16(ILI9341_VCOMCONTROL1, 0x2B2B);

^

Sketch uses 18254 bytes (56%) of program storage space. Maximum is 32256 bytes.
Global variables use 136 bytes (6%) of dynamic memory, leaving 1912 bytes for local variables. Maximum is 2048 bytes.

i don’t know what happen to my new tft lcd screen. i followed exactly same as youtuber. i use same hardwares, same code, same libraries etc but what i can see is only white screen!

having trouble more than 5days and never fixed!! tried many other difference ways but never get fixed!!

this forum is my last hope. anyone please help. please,

You can't possibly have a white screen when you can't even get code to compile. So, how ARE you getting a white screen?

PaulS:
You can’t possibly have a white screen when you can’t even get code to compile. So, how ARE you getting a white screen?

I have no idea. i just copy/past error and code… it just shows only white screen.