Skip to content

ILI9341 Drawing

The ILI9341 chip is a 262144-color single-chip SOC driver for a TFT liquid crystal display with a resolution of 240x320 dots (RGB).

Source Code

Configuration file

These examples will all use the following config file:

config.py

1
2
3
4
5
6
7
8
9
SCK_PIN = 2
MISO_PIN = 3 # labeled SDI(MOSI) on the back of the display
DC_PIN = 4
RESET_PIN = 5
CS_PIN = 6
ROTATION = 90

WIDTH=320
HEIGHT=240

We also put the color names in a colors.py file that calculates the colors using a name.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from ili9341 import color565

WHITE = color565(255,255,255)
BLACK = color565(0,0,0)
RED = color565(255,0,0)
ORANGE = color565(255,128,0)
YELLOW = color565(255,255,0)
GREEN = color565(0,255,0)
BLUE = color565(0,0,255)
CYAN = color565(0,255,255)
PURPLE = color565(255,0,255)

Simple Drawing

1