import time
time.sleep(0.1) # Wait for USB to become ready
from time import sleep
from ILI9341 LCD-TFT import Display, color565
from machine import Pin, SPI
# Installing the driver
To use this drivers on the pyboard:
* Copy the python file available under the /ILI9341/ (directory) to your Python Board
** eg: `lcd.py`, `colors.py` , `registers.py` , etc
* Create a `images` subfolder in the root of your pyboard to store bitmap images.
** also copy the bmp files if you plan to test example script
## Consideration for micro SDCard
If you are planing to use some bitmap to be displayed on the TFT (yes, the driver can does it!) then we ***strongly recommand to use an micro SDCard*** as storage device.
Indeed, the pyboard embedded memory (inner flash) will immediately be surged with the first image copied on the pyboard.
# directory structure
This section will describe the arrangement of the main directories.
* ***pyboard_drive/ILI9341/*** - the place for the pyboard files (to be copied on the Pyboard)
* ***pyboard_drive/ILI9341/images/*** - the place for the pyboard deriver images (OPTIONAL: to be copied on the pyboard)
* ***pyboard_drive/ILI9341/examples/*** - A collection of samples scripts. You do not need to copy them on the pyboard. Learn them to leverage the power of the driver.
* ***pyboard_drive/ILI9341/wirings/*** - A collection of wiring between the PyBoard and various model of TFT Screens (ILI9341 powered)
#https://github.com/github-stone/micropython-ili9341-1
def test():
"""Test code."""
# Baud rate of 40000000 seems about the max
spi = SPI(1, baudrate=10000000, sck=Pin(14), mosi=Pin(15))
display = Display(spi, dc=Pin(6), cs=Pin(17), rst=Pin(7))
# Set display color to red
display.clear(color565(255, 0, 0))
sleep(1)
# Set display color to orange
display.clear(color565(255, 128, 0))
sleep(1)
# Set display color to yellow
display.clear(color565(255, 255, 0))
sleep(1)
# Set display color to green
display.clear(color565(0, 255, 0))
sleep(1)
# Set display color to blue
display.clear(color565(0, 0, 255))
sleep(1)
# Set display color to purple
display.clear(color565(128, 0, 128))
sleep(1)
# Set display color to pink
display.clear(color565(255, 192, 203))
sleep(1)
# Set display color to brown
display.clear(color565(139, 69, 19))
sleep(1)
# Set display color to gray
display.clear(color565(128, 128, 128))
sleep(1)
# Set display color to white
display.clear(color565(255, 255, 255))
sleep(1)
test()