In this tutorial, we will go over more examples of what can be done with the TFT 1.44 and Arduino Nano from Robo-Geek kits.
Please refer to learn how to connect to TFT 1.44:
And if you are new to Arduino World, we strongly suggest you start with:
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Screen Reset Example Inspiration
At Robo-Geek we are big fans of the Short Circuit movie. This tutorial is inspired from the opening scene, Struck by Lighting, where the computer screen housed in Johnny's 5 torso gets reset-ted. With the TFT 1.44, we can make a similar screen but of course it would be for miniature robots.
Notice as system checks are conducted different titles flash in red letters. So this is so cool!
This simple code will be used to recreate the system check sequence.
Step 2: The Code
Like all Arduino code, there are 2 parts:
The setup function and the loop function. The rest of the functions are auxiliary functions.
There is a simple trick to create animation. It's to draw in color, then draw the same thing in black. As long as the background is black, the effect to the user is that the text or drawing are flashing. The processing speed is fairly fast so quick animations are possible with slight delays.
The screen was divided in 10 sections, 5 in each half of the screen.
The print_messages() function prints the particular section selected and the color of the font selected.
The print_all_messages() function prints all sections
The print_labels() function draws the labels for the screen (ON/OFF buttons, etc)
The draw_buttons() function draws the buttons
The animate_messages() function calls the print_messages() function and displays the messages in what appears a random sequence:
Idea for improvement: This code could be improved and the random function could be used instead.
Step 3: Example: Wouldn't You Like to Be a Pepper Too?
More inspiration from Short Circuit movie:
As per previous example, this code shows how to interact with the TFT 1.44 from Robo-Geek Kits.
The printDrPepper() function prints the message.
The printDrPepper_withdelay() function prints the message with delay.
The rotateText() function prints the message with delay but rotates it in the screen.
With the TFT 1.44 some times the settings come configured as if the screen 128x160, therefore an offset may be needed in the vertical direction. Refer to the following tutorial Step 4 for more details. Again part of the fun hacking these little devices.
Step 4: Other Sources
If you are looking for more inspiration, we suggest to watch this excellent video from Educ8s.
However, it's important to note that the libraries used are different than the ones shown in the tutorials so we are not responsible for the validity of the video. Having said that, it's always good to experiment and learn from as many people from the open source community.
Best of luck with your project and let us know what inspires in your next project.