program arduino uno with visuino to draw on ili9341 tft touchscreen display shield with pen
I \'ve made a couple of phonino TFT Display tutorials that show you how to animate the bitmap and how to Display GPS coordinates on the shield, but I did not show you how to use the touch screen feature.
In this tutorial, I will show you how easy it is to program Arduino UNO using visualino in order to be able to draw and doodle on the screen using stylus touch screen pen or finger touch.
Insert the TFT shield into the top of the Arduino Uno, start programming the Arduino on video oto, you need to install the Arduino IDE from here: Make sure to install 1. 6.
7 or higher, otherwise this statement will not work!
Phonino: installation is also required.
Next, we need to add graphics to draw an ellipse element in order to render a small circle in the position of the touch screen.
In order for the ellipse to be displayed as a circle, we need to specify the width and height.
We also want the coordinates of the ellipse to be central, not the top left corner.
To draw a circle in a specific position, we need to control its X and Y positions.
To do this, we will add pins for the X and Y properties and connect them to the X and Y touch positions of the Shield: the touch screen has a pin that indicates the strength of pressing the screen.
In order to detect when the pen touches the screen, we can use the \"compare analog values\" component and specify the level: draw the circle accurately at the touch position, we need to specify X and Y first, and then force the circle to be drawn.
In order to generate the clock for this operation repeatedly, we can use the duplicate component.
It will generate the clock at the speed of the Arduino performing the main loop.
Because we want to do a touch test before drawing the circle, we will use the \"clock multi-source\" component.
For each clock on its input, the component will generate the clock on its output in the order of the output, ensuring that events occur in an accurate order.
To enable and disable drawing of circles, we will use the \"clock on/off switch\" component: disable the \"clock on/off switch\" component when the pen is touched or lifted, we need to connect the switch to the \"compare analog values\" component: Congrats!
You have finished the project.
Picture 2 and video show the items connected and connected.
You can use a touch screen stylus or finger to doodle and draw on the ILI9341-based TFT touch screen display as shown in the video.
To clear the display, press the reset button.
In Figure 1, you can see the complete visualization.
Also attached is the visualino project I created for this tutorial.