TFT TOUCH SCREEN ONLY DISPLAYS WHITE!

Hello
I am needing help with my tft touch screen project.
The screen only displays white after I upload the code.
Here is the code:

#include _ADAFRUIT_TOUCHSCREEN_H_
#define _ADAFRUIT_TOUCHSCREEN_H_
#include <stdint.h>

class TSPoint {
 public:
  TSPoint(void);
  TSPoint(int16_t x, int16_t y, int16_t z);
  
  bool operator==(TSPoint);
  bool operator!=(TSPoint);

  int16_t x, y, z;
};

class TouchScreen {
 public:
  TouchScreen(uint8_t xp, uint8_t yp, uint8_t xm, uint8_t ym);
  TouchScreen(uint8_t xp, uint8_t yp, uint8_t xm, uint8_t ym, uint16_t rx);

  bool isTouching(void);
  uint16_t pressure(void);
  int readTouchY();
  int readTouchX();
  TSPoint getPoint();
  int16_t pressureThreshhold;

private:
  uint8_t _yp, _ym, _xm, _xp;
  uint16_t _rxplate;
};

#endif

Thank you for your help.

Go on. Your program has no screen. Of course it can't show anything.

Post a link to the actual display that you have bought e.g. Ebay sale.

Then someone might advise on display library and touch library.

David.

Thank you David
I have tried several programs with this screen and each time it does nothing.
I would have posted other code, but it exceeded the character limit.
A few other people using this screen have had the same problem.

Here is the link to the screen: Arduino tft touch screen - ebay.com

Here is the link to the tutorial that I was following: HowtoMechatronics.com - tft touch screen tutorial.

Natha

Thanks for the links. It makes all the difference.
The tutorial is for Mega2560 display shields with XPT2046 Touch chip.

Your display is Mcufriend. Install MCUFRIEND_kbv library via Library Manager. Install Adafruit_GFX library

The Touch panel is resistive. Install Adafruit_Touchscreen library

Always use the IDE Library Manager when possible.
Run the examples that come with each library.

If you have a problem, quote library version and example name.

David.

Thank you David

I am using an arduino UNO

Will that make a difference?
Do I need an arduino Mega?

Thank you

Natha

A Uno will be fine with your Red 2.4 inch Mcufriend shield.

Hello
The code that I am trying to use is at the bottom of this page.It exceeds the maximum character amount, so I was not able to post it.
When I try to upload the code, it shows the following error message,

Arduino: 1.8.7 (Mac OS X), Board: "Arduino/Genuino Uno"

sketch_dec06a:6:9: error: macro names must be identifiers
#define <ADAFRUIT_GFX.h>
^
sketch_dec06a:7:9: error: macro names must be identifiers
#define <ADAFRUIT_TOUCHSCREEN.h>
^
sketch_dec06a:39:2: error: #endif without #if
#endif
^
exit status 1
macro names must be identifiers

That tutorial is NOT suitable for your display.

Look at the photos. The tutorial display has got a blue pcb with 18x2 header pins (suitable for a Mega2560). The blue display will NOT fit on your Uno.

Your Red display fits on your Uno.
The libraries that I suggested have example programs. Try them.

David.

Hello David

Thank you so much.

I have got it to work now
Can’t get that code to work but found different code.

Thank you

Natha :slight_smile:

Well done.

I presume that you installed MCUFRIEND_kbv, Adafruit_GFX, Adafruit_Touchscreen libraries.

And ran the examples from Adafruit_Touchscreen and MCUFRIEND_kbv

It is always helpful to say which example or which web link you were using.

David.