On AliExpress there are a lot of screens meant for the Arduino’s. Most of the time the driver chip is not mentioned in the description and that is how I ended up with 12 displays with the ILI9342 driver. Luckely AdaFruit has a library that supports the ILI9341 and from the documentation of those driver chips I found that they are almost identical. The difference is mainly the resolution. One has 320×240 and the othet 240×320. That means some axis need to be rotated and mirrored. Strange, but the colors were also inverted…
That is what I did in attached library. I included some demo code to test the functionality.
Using the display involves the following steps:
- Download the Arduino IDE from https://www.arduino.cc/en/main/software
- Make sure the USB to serial chip of your Arduino is supported. For Windows that could need one of the following: CH341SER_EXE or CP210x
- Download the ili9342 library
- Install the Arduino IDE
- Start the Arduino IDE
- Open “Sketch → Include Library → Add .ZIP Library…” and select the ili9342 library zip file
- Open “Sketch → Include Library → Manage Libraries…”. Search for the ‘Adafruit GFX Library’ and install it (including the dependencies)
- Open “Sketch → Include Library → Manage Libraries…”. Search for the ‘Adafruit TouchScreen’ and install it (including the dependencies)
- Open “File → Examples → TFTLCD-Library_ILI9342” and one of the example programs
- Select the correct Arduino board from “Tools → Board”
- Select the correct serial port from “Tools → Port”
- Upload the sketch to the Arduino from “Sketch → Upload”
Excercises:
- Change the number of brick columns and rows
- Change the size of the bat and ball
- Also add a point if the bat hits the ball
- Change the bounce angle of the ball depending on the spot where the ball hits the bat
- Make the bricks more colorful
- Change scoring depending on what color of brick is hit
- Make some bricks that need to be hit twice to be deleted
- … Think of something yourself 🙂
Leave a Reply