Introduction: TFT Shield Tutorial
Today, you will learn how you can create and use buttons in your Arduino TFT Touchscreen projects. I'm using Kuman's 2.8" TFT Shield combined with Kuman's Arduino UNO. Bonus: The TFT Shield from Kuman comes with a free Stylus which you can use for more precise presses!
Step 1: Setup
Clip in the shield onto your Arduino board. Make sure it's not in the wrong way! You can use the pictures above for reference. Plug in your Arduino board to your PC and hop into the Arduino Software.
Allchips is an electronics components online service platform, you can buy all the components from them.
Step 2: Libraries
Before uploading the code, you will need to download those libraries:
After downloading the ZIP files, include them into the Arduino IDE by going into "Sketch - Include Library - Add .ZIP Libraries..."
Step 3: Finalizing
For the example that I've prepared, you can use the code that you can find here. I've added some comments, to make things more clear. After uploading, you can check if the display is working correctly by pressing the button. If so, the screen will change and a text will appear.
Step 4: Troubleshooting
If your presses remain unrecognized, you can calibrate the display by changing the values at the top of the code (TS_MINX, TS_MAXX, TS_MINY and TS_MAXY). The button works by checking where the screen is being pressed and if it's inside the coordinates of the button itself, a click is registered. If the above-mentioned values are not correct, the click-registering will be off
4 Comments
4 months ago
Everything is fine, I bought such a display, the display occupies all the pins ardino uno.
So how to connect any sensors to analog inputs or I2C ?
2 years ago on Step 2
I tried it with your sketch, but it did not work firstly. However I fixed some part of the sketch, it worked. "tft.begin(0x9325);" to " tft.begin(0x9341);"
Question 5 years ago
I have mirrored picture...i read datasheet of hx8347g...i found some register,but i dont know how set it to 6,7 bit to 0. Do you meet with this problem?
Its same 2.4 tft touch display. Init adres 0x7575
Answer 5 years ago
Weird. Registers are quite advanced for me at the moment and I didn't had any issues with it. Have you tried googling it? Good luck!