Sponsor Link:
UTSource.net Reviews
It is a trustworthy website for ordering electronic components with cheap price and excellent quality.
Mounting the circuitThis project's circuit is by far, the easiest to mount as this shield comes prepared to be fitted onto an Arduino Uno. Each pin on this shield should go into every pin on the Arduino perfectly and I recommend that you line it up carefully before applying pressure to press the display down into each of the pins. However, this LCD module also has a 6-pin ICSP (In-Circuit Serial Programmer) header which matches the male ICSP header pins on the Arduino, thus, ensuring that you match those pins up as well is critical to making sure that you mount this module correctly. Remember, don't use too much force on the module as it may damage the pins or the display itself, so be careful! Then, once this module has been mounted on to your Arduino board, plug in your USB cable and you are now ready to go. For this project, you will not be importing files into the SD card, so taking out the SD card from this module is not necessary.
Arduino TFT LCD Display Module with Resistive Touch Project Code
Please download the three code libraries from the link given before compiling and uploading the program: https://bitbucket.org/displaymodule/dmtftlibrary/src/master/
#include <SPI.h>
#include <DmTftIli9341.h>
#include <utility/BubbleDemo.h>
#define TFT_CS 10
#define SD_CS 8
#define F_CS 6
#define T_CS 4
DmTftIli9341 tft = DmTftIli9341(10, 9);
BubbleDemo bubbleDemo(&tft, tft.width(), tft.height());
void setup ()
{
// Set CS SPI pin HIGH for all SPI units, so they don't interfere
pinMode(TFT_CS, OUTPUT);
pinMode(T_CS, OUTPUT);
pinMode(SD_CS, OUTPUT);
pinMode(F_CS, OUTPUT);
digitalWrite(TFT_CS, HIGH);
digitalWrite(T_CS, HIGH);
digitalWrite(SD_CS, HIGH);
digitalWrite(F_CS, HIGH);
tft.init();
}
void loop()
{
bubbleDemo.run(750, 20);
}
About the code
With DisplayModule's DMTFTLibrary, the software part of this project is made 10x easier due to no manual coding needed for each function performed. DisplayModule has also already written the main part of the code, so that will save you some time if you need to use this code again. Firstly, the code starts by defining some libraries used: we declare the SPI (Serial Peripheral Interface) library for communication between the TFT and the Arduino, the DMTFTIli934 library, which is used to drive the TFT with an Arduino and the BubbleDemo library, which is basically the library which stores all the code for this program. Then, we define some pins which aid in the software communication to the TFT display. We mention the TFT chip select pin on pin 10, the SD chip select pin on pin 8, the flash chip select pin on pin 6 and the touch screen chip select pin on pin 4. After that, we now add in a line where we declare the TFT being used with the chip select pin on pin 10 and the data/command (DC) pin being on pin 9 and on the following line, we mention that the bubble demo program will be used, which will consume the whole TFT display's length and width. Now, the void setup section is present, where we set the TFT_CS, T_CS, SD_CS and the F_CS pins as output pins, so that data will be fed into the Arduino from the TFT display. Next, we declare the same set of pins high, meaning that they will be turned on, active and performing their individual function during this sketch. We then also initialise the display to start it up, which transitions us to the void loop section, with one command only. This command is to basically run the bubbleDemo program for 750 loops with a delay time of 20 milliseconds. Now, the software part has been already done and your program should be up and running fine!
Amazing opportunities
Also, be sure to check out PCBWay, a leading manufacturer and distributor in PCB design and manufacturing. They have amazing prices and excellent quality in their services, so don't miss out on them! Plus, PCBWay has an amazing website, online Gerber viewer function and a gift shop so make sure to check out their links below:
PCBWay Free Online Gerber Viewer Function: https://www.pcbway.com/project/OnlineGerberViewer.html
PCBWay Gift Shop: https://www.pcbway.com/projects/gifts.html
Enjoy! Contact us for any inquiries!