Serial.print(F("Rectangles (outline) ")) Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE)) Serial.println(F("Benchmark Time (microseconds)")) Serial.print("Self Diagnostic: 0x") Serial.println(x, HEX) X = tft.readcommand8(ILI9341_RDSELFDIAG) Serial.print("Image Format: 0x") Serial.println(x, HEX) Serial.print("Pixel Format: 0x") Serial.println(x, HEX) Serial.print("MADCTL Mode: 0x") Serial.println(x, HEX) Serial.print("Display Power Mode: 0x") Serial.println(x, HEX) Uint8_t x = tft.readcommand8(ILI9341_RDMODE) read diagnostics (optional but can help debug problems) #define TFT_DC 10 // TFT DC pin is connected to arduino pin 10Īdafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST) #define TFT_RST 9 // TFT RST pin is connected to arduino pin 9 #define TFT_CS 8 // TFT CS pin is connected to arduino pin 8 #include // include Adafruit ILI9341 TFT library #include // include Adafruit graphics library
This is a free software with NO WARRANTY. MIT license, all text above must be included in any redistribution Written by Limor Fried/Ladyada for Adafruit Industries.
Please support Adafruit and open-source hardware by purchasing These displays use SPI to communicate, 4 or 5 pins are required toĪdafruit invests time and resources providing this open source code, This is our GFX example for the Adafruit ILI9341 Breakout and ShieldĬheck out the links above for our tutorials and wiring diagrams
The previous 2 libraries are included in the main code as shown below : Go to Arduino IDE -> Sketch -> Include Library -> Add. The previous two libraries can also be installed manually:ĭownload both libraries from the following two links:Īdafruit ILI9341 TFT library -> direct linkĪdafruit graphics library -> direct link The second library is Adafruit graphics library which can be installed also from Arduino IDE library manager.
The first library is a driver for the ILI9341 TFT display which can be installed from Arduino IDE library manager (Sketch -> Include Library -> Manage Libraries …, in the search box write “ili9341” and choose the one from Adafruit). The following Arduino code requires two libraries from Adafruit Industries: Interfacing Arduino with ILI9341 TFT display code: SCK pin is connected to Arduino digital pin 13.īL (LED) pin is connected to Arduino 5V pin, MOSI pin is connected to Arduino digital pin 11, RST pin is connected to Arduino digital pin 9,ĭ/C pin is connected to Arduino digital pin 10, So, the ILI9341 TFT display is connected to the Arduino board as follows (each one through voltage divider):ĬS pin is connected to Arduino digital pin 8,
Each voltage divider consists of 2.2k and 3.3k resistors, this drops the 5V into 3V which is sufficient. To connect the Arduino to the display module, I used voltage divider for each line which means there are 5 voltage dividers. This module has a built-in 3.3V regulator which supplies the display controller with 3.3V from the 5V source.Īll Arduino UNO board output pins are 5V, connecting a 5V pin to the ILI9341 TFT display may damage its controller. The display module is supplied with 5V that comes from the Arduino board. So, the display side pins which numbered from 1 to 9 are (from left to right): VCC (5V), GND (ground), CS (chip select), RST (reset), DC (or D/C: data/command), MOSI (or SDI), SCK (clock), BL (back light LED) and MISO (or SDO).Īs mentioned above, the ILI9341 TFT display controller works with 3.3V only (power supply and control lines). The ILI9341 TFT display board which is shown in the circuit diagram above has 14 pins, the first 9 pins are for the display and the other 5 pins are for the touch module.