Series: Tried Using Touch Panel TFT Display GT-SP with Arduino

Controlling an LED Connected to Arduino from a Touch Screen

Controlling an LED Connected to Arduino from a Touch Screen

Hello everyone, I’m @kissaten, someone interested in trying out electronics projects. In this series, I, as a beginner in electronics, will explain the process of connecting a touch panel TFT/LCD display to Arduino and developing various things. The touch screen used is Noritake’s 7-inch touch display GT-SP series, “GTWV070S3A00P.”

In this installment, we will operate an LED connected to Arduino from the touch screen.

This article is a continuation of the previous one (“Connecting Arduino and Touch Screen to Display Text”). If you haven’t read the previous article yet, you can check it out here.

Adding Arduino and LED Connection

This time, as we want to control an LED from the touch screen, we’ll add an LED and a resistor to the circuit from the previous article, as shown in the diagram below. Specifically, connect “D2 – Resistor (1K ohm) – LED – GND.” Pay attention to the polarity of the LED. (Wiring between GT-SP and Arduino is omitted. If you want to check, please refer to the previous article.)

Picture by [Fritzing (CC BY-SA)]

Creating a Project to Write to the Touch Screen

Using GT Design Studio, create a project where pressing buttons turns the LED on or off. For clarity, this time, register two buttons, ON and OFF, on the GT-SP.

Explanation

Create buttons “BUTTON_0” and “BUTTON_1” on page “PAGE_0” and assign the event action “DATA_TX_FIX” to each. In the content, use NUMBER to input “1” (ON) for one button and “0” (OFF) for the other.

Now, when the GT-SP buttons are pressed, a project has been created to send the values “1” or “0” to Arduino.

Creating a Program to Upload to Arduino

The program created for this occasion is as follows.

 

Interpreting the Program

GT-SP’s buttons, when pressed, send the numerical values “1” or “0” to Arduino. Arduino reads this data and turns the LED on if the value is “1” and off if it’s “0.”

In detail, first, the LED pin is assigned as “LED_PIN,” assuming it’s connected to pin D2. When the host receives serial data from GT-SP, the function gtsp_signal_read_val() is called, returning the numeric data “1” or “0” sent from GT-SP. In the subsequent if statement, if the received value is “1,” it sets “LED_PIN” to “HIGH” to turn on the LED; if it’s “0,” it sets it to “LOW” to turn off the LED.

Execution Result

Pressing “BUTTON_0” (ON button) on GT-SP lights up the LED connected to Arduino, and pressing “BUTTON_1” (OFF button) turns it off. This confirms that the program uploaded to Arduino is working correctly. Additionally, checking the operation in the terminals of both GT-SP and Arduino confirms the proper communication.

In the next session, we’ll display the values from a sensor connected to Arduino on the GT-SP.