Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Touchscreen+Display

Importance and Utility of Touchscreen+Display

The use of touchscreen displays has become increasingly popular in various electronic devices, ranging from smartphones to industrial control systems. The combination of a touchscreen and a display offers a user-friendly interface that allows users to interact with the device through touch gestures and provides visual feedback. This technology has revolutionized the way we interact with electronic devices, making them more intuitive and convenient to use.

Touchscreen displays are essential in applications where user input is required, such as smartphones, tablets, and information kiosks. They provide a more natural and intuitive way of interacting with the device compared to traditional input methods like buttons or keyboards. Additionally, touchscreen displays are widely used in industrial control systems, where operators need to monitor and control complex processes in real-time.

Projeto: Touchscreen Weather Station

In this example project, we will create a touchscreen weather station using an Arduino board and a touchscreen display. The objective of this project is to display real-time weather information, including temperature, humidity, and weather conditions, on the touchscreen display. Users will be able to interact with the display to switch between different weather information screens and access additional features like setting alarms or viewing historical data.

Lista de componentes:

Exemplos:

  1. Initializing the Touchscreen Display:
    
    #include <Adafruit_GFX.h>
    #include <Adafruit_ILI9341.h>
    #include <TouchScreen.h>

define TFT_CLK 13

define TFT_MISO 12

define TFT_MOSI 11

define TFT_CS 10

define TFT_DC 9

define TFT_RST 8

define TS_CLK 6

define TS_CS 5

define TS_DIN 4

define TS_DOUT 3

define TS_IRQ 2

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CLK, TFT_MISO, TFT_MOSI, TFT_CS, TFT_DC, TFT_RST); TouchScreen ts = TouchScreen(TS_XP, TS_YP, TS_XM, TS_YM, TS_RX);

void setup() { tft.begin(); tft.setRotation(3); ts.begin(); }

void loop() { // Touchscreen code here }


2. Reading Touchscreen Input:
```cpp
void loop() {
  TSPoint touch = ts.getPoint();

  if (touch.z > MINPRESSURE && touch.z < MAXPRESSURE) {
    int16_t x = map(touch.x, TS_MINX, TS_MAXX, TFT_HEIGHT, 0);
    int16_t y = map(touch.y, TS_MINY, TS_MAXY, TFT_WIDTH, 0);

    // Process touchscreen input here
  }
}
  1. Displaying Weather Information:
    
    void displayTemperature(float temperature) {
    tft.setTextColor(ILI9341_WHITE);
    tft.setTextSize(2);
    tft.setCursor(10, 10);
    tft.print("Temperature: ");
    tft.print(temperature);
    tft.println(" °C");
    }

void displayHumidity(float humidity) { tft.setTextColor(ILI9341_WHITE); tft.setTextSize(2); tft.setCursor(10, 40); tft.print("Humidity: "); tft.print(humidity); tft.println(" %"); }

void displayWeatherConditions(String conditions) { tft.setTextColor(ILI9341_WHITE); tft.setTextSize(2); tft.setCursor(10, 70); tft.print("Conditions: "); tft.println(conditions); }

void loop() { // Read temperature and humidity from sensor float temperature = readTemperature(); float humidity = readHumidity();

// Read weather conditions from an API String conditions = readWeatherConditions();

// Display weather information on the touchscreen displayTemperature(temperature); displayHumidity(humidity); displayWeatherConditions(conditions); }



To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.