Hey, I have a bit of a problem with the TOUCH inputs on the ESP32, namely it randomly detects touches on them, but only when I add 3 touches in the program. When it reads only one it doesn't have any problem. I am sending the program below.
I will add that the detected values when triggered are above 70 where in the IF I declared that it should only react when it is below 40, maybe someone of you can advise what I messed up ??
.
I will add that the detected values when triggered are above 70 where in the IF I declared that it should only react when it is below 40, maybe someone of you can advise what I messed up ??
//TFT
#include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip
#include <SPI.h>
// SCK - D18
// SDA - D23
// A0 - D2
// RESET - D4
// CS - D15
TFT_eSPI tft = TFT_eSPI();
//DHT
#include "DHTesp.h"
DHTesp dht;
// Blynk oraz WiFi
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
Skasowane dane dostepowe do Blynka !!
//Zmienne
byte StanPrzekaznik = 0;
byte cisnienie;
float Aktualny;
byte Wilgotnosc;
float INiza;
float OUTiza;
//Menu
byte SETmenu;
float SETtemp;
float SEThist;
// Timery
BlynkTimer LCD;
BlynkTimer INDHT;
void INDHTupdate()
{
Aktualny = dht.getTemperature();
Wilgotnosc = dht.getHumidity();
}
void LCDupdate()
{
//tft.drawString("Temperatura:", 0, 18, 2);
// Lewa, od gory, cos
tft.fillScreen(TFT_BLACK);
// Stale
tft.setTextColor(TFT_RED);
tft.setTextSize(2);
tft.drawString("Ustawienia Temperatury:", 0, 0, 1);
tft.setTextSize(1);
tft.setTextColor(TFT_GREEN);
tft.drawString("Temperatura:", 0, 18, 2);
tft.drawString("Wilgotnosc:", 0, 36, 2);
if (StanPrzekaznik == 1){
tft.setTextColor(TFT_ORANGE);
tft.drawString("Grzanie", 84, 34, 2);
}
else if (StanPrzekaznik == 0){
tft.setTextColor(TFT_CYAN);
tft.drawString("Chlodzenie", 84, 34, 2);
}
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass, DaneLogowania);
//Timery
LCD.setInterval(5000L, LCDupdate);
INDHT.setInterval(1000L, INDHTupdate);
tft.init();
tft.setRotation(1);
tft.fillScreen(TFT_BLACK);
dht.setup(17, DHTesp::DHT11);
}
void loop()
{
Blynk.run();
LCD.run();
INDHT.run();
if (touchRead(T5) < 1){
Serial.println("Menu");
delay(1000);
}
if (touchRead(T6) < 1){
Serial.println("dodaj");
delay(1000);
}
if (10 > touchRead(T4)){
Serial.println("Odjemij");
delay(1000);
}
}