Problems Using Adafruit ILI9341 2.8" tft lcd with Arduino Uno

I have a 2.8" tft lcd with shield. Im using that with an Arduino uno to make an interface to set certain parameters for my project through the LCD. My program will have different menus. I have some functions written already. They are only supposed to make the screen layout on the basis of the button pressed. Is there a way to clear the screen using the Adafruit libraries? I know there is a function to do so using the UTFT library but that does not seem to work with the shield I have.

Im a newbie so I dont know much about the connections. I only figured that out using the examples given in the libraries. The screen works fine for the first menu but when I press the button, it turns white.

Any help would be appreciated.

Please say exactly what board, Touch controller etc.
The website says there are several versions.

If you have a problem with a Library example, say which example.

If you have a problem with your own custom sketch, paste or attach the code.
Explain what you expected. And what you actually got.

David.

The link for the tft lcd i have: https://www.amazon.co.uk/Elegoo-Inches-Screen-Technical-Arduino/dp/B01EUVJYME/ref=sr_1_1?ie=UTF8&qid=1507157067&sr=8-1&keywords=elegoo+tft

It is based on this LCD:

It uses an ILI9341 controller. Im using it with an arduino UNO r3 with Adafruit's Libraries. The example codes with the touch screen work fine and they use the same libraries.

Whenever i run my code, everything works fine till the first page which only has one button. When the button is pressed, it is supposed to draw another page. In my code, i change the screen to blue color and try to print some text. If i only have tft.fillScreen(BLUE), it does not change anything. And if i have the code as it is with the text, i get a white screen.

I was looking at a similar project where they use UTFT libraries which has a clrScr() function. There is nothing to clear the screen in the libraries I am using. Could that be the problem?

LCDTest1.ino (6.77 KB)

TouchScreen.zip (7.92 KB)

Adafruit_GFX.zip (11.6 KB)

Adafruit_TFTLCD.zip (160 KB)

Touchscreen and TFT share the same pins.

You should restore XM, YP to digital after any call to TouchScreen library e.g. ts.getPoint()

pinMode(XM, OUTPUT);

I am sure that Adafruit have a note about this in their examples.

David.

That fixed the problem I was stuck on for a couple of days now.
Thanks a lot!

Sidk

Do you still have a copy of the code for 2 pages? Thanks