camsysca:
by providing the code.
Ok I will post it here it is:
#include <FS.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
TFT_eSPI tft = TFT_eSPI();
#include "teclado.h"
#include <Adafruit_GFX.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_ILI9341.h>
#include <Adafruit_STMPE610.h>
//-------------------DISPLAY--------------------------
#define CALIBRATION_FILE "/TouchCalData3"
#define REPEAT_CAL false
#define TS_MINX 150
#define TS_MINY 130
#define TS_MAXX 3800
#define TS_MAXY 4000
#define FRAME_X 52
#define FRAME_Y 94
#define FRAME_W 135
#define FRAME_H 235
#define REDBUTTON_X FRAME_X
#define REDBUTTON_Y FRAME_Y
#define REDBUTTON_W FRAME_W
#define REDBUTTON_H FRAME_H
void touchInterfaz();
void imagenInterfaz();
void imagenBoton();
//-------------------RELE------------------------------
#define pinRele_1 32
#define pinRele_2 35
#define pinRele_3 34
int retraso;
bool estado = false;
int numc = 1;
int tm = 0;
bool e1 = false;
bool e2 = false;
bool e3 = false;
bool e4 = false;
bool e5 = false;
bool e6 = false;
bool e7 = false;
bool e8 = false;
bool e9 = false;
bool e10 = false;
bool e11 = false;
bool e12 = false;
String dp = ":";
int sp = dp.toInt();
//****************************************************************************************
void setup() {
Serial.begin(9600);
//----------------------------------------------------
pinMode(ledWifi, OUTPUT);
digitalWrite(ledWifi, HIGH);
//---------------------
pinMode(pinRele_1, OUTPUT);
pinMode(pinRele_2, OUTPUT);
pinMode(pinRele_3, OUTPUT);
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_2, LOW);
digitalWrite(pinRele_3, LOW);
//----------------------------------------------------
tft.begin();
tft.setRotation(0);
tft.setSwapBytes(true);
uint16_t calData[5] = { 303, 3452, 412, 3382, 4 };
tft.setTouch(calData);
tft.fillScreen(TFT_WHITE);
imagenInterfaz();
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
}
//******************************************************************************************
void touchInterfaz(
int &min1, int &min2, int &min3, int &min4 , int &min5 , int &min6 ,
int &min7, int &min8, int &min9, int &min10, int &min11, int &min12,
int &hr1 , int &hr2 , int &hr3 , int &hr4 , int &hr5 , int &hr6 ,
int &hr7 , int &hr8 , int &hr9 , int &hr10 , int &hr11 , int &hr12 ,
int &dia1, int &dia2, int &dia3, int &dia4 , int &dia5 , int &dia6 ,
int &dia7, int &dia8, int &dia9, int &dia10, int &dia11, int &dia12,
int &sec1, int &sec2, int &sec3, int &sec4 , int &sec5 , int &sec6 ,
int &sec7, int &sec8, int &sec9, int &sec10, int &sec11, int &sec12
);
void loop() {
int m1 ;
int m2 ;
int m3 ;
int m4 ;
int m5 ;
int m6 ;
int m7 ;
int m8 ;
int m9 ;
int m10;
int m11;
int m12;
int h1;
int h2;
int h3;
int h4;
int h5;
int h6;
int h7;
int h8;
int h9;
int h10;
int h11;
int h12;
int d1;
int d2;
int d3;
int d4;
int d5;
int d6;
int d7;
int d8;
int d9;
int d10;
int d11;
int d12;
int s1 = 59;
int s2 = 59;
int s3 = 59;
int s4 = 59;
int s5 = 59;
int s6 = 59;
int s7 = 59;
int s8 = 59;
int s9 = 59;
int s10 = 59;
int s11 = 59;
int s12 = 59;
touchInterfaz(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12,
h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12,
d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12,
s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12);
}
//------------------------------------------------------------------------------------------
//FUNCION DECLARACION DE TECLAS DE DISPLAY
void imagenBoton() {
tft.fillRoundRect(puntoX, puntoY, 112, 42, 2, TFT_WHITE);
}
void imagenBoton3() {
tft.fillRoundRect(puntoX, puntoY, 87, 42, 2, TFT_WHITE);
}
void imagenBoton1() {
tft.fillRoundRect(puntoX, puntoY, 52, 42, 2, TFT_WHITE);
}
void touchInterfaz(int &s1, int &s2, int &s3, int &s4, int &s5, int &s6, int &s7, int &s8, int &s9, int &s10, int &s11, int &s12, int &m1, int &m2, int &m3, int &m4, int &m5, int &m6, int &m7, int &m8, int &m9, int &m10, int &m11, int &m12, int &h1, int &h2, int &h3, int &h4, int &h5, int &h6, int &h7, int &h8, int &h9, int &h10, int &h11, int &h12, int &d1, int &d2, int &d3, int &d4, int &d5, int &d6, int &d7, int &d8, int &d9, int &d10, int &d11, int &d12) {
//FUNCION PARA BOTON EN SEGUNDO int
if (tft.getTouch(&x, &y))
{ //20, 25 135, 25
//----------------------------------- RESET
if (x > 7 && x < 52 && y > 44 && y < 88) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
d1 = 0;
d2 = 0;
d3 = 0;
d4 = 0;
d5 = 0;
d6 = 0;
d7 = 0;
d8 = 0;
d9 = 0;
d10 = 0;
d11 = 0;
d12 = 0;
h1 = 0;
h2 = 0;
h3 = 0;
h4 = 0;
h5 = 0;
h6 = 0;
h7 = 0;
h8 = 0;
h9 = 0;
h10 = 0;
h11 = 0;
h12 = 0;
m1 = 0;
m2 = 0;
m3 = 0;
m4 = 0;
m5 = 0;
m6 = 0;
m7 = 0;
m8 = 0;
m9 = 0;
m10 = 0;
m11 = 0;
m12 = 0;
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(10, 5);
tft.print("Can.");
tft.setCursor(55, 5);
tft.print(numc);
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(1);
tft.setCursor(128, 20);
tft.print("D");
tft.setCursor(150, 20);
tft.print("H");
tft.setCursor(176, 20);
tft.print("M");
tft.setCursor(205, 20);
tft.print("S");
tft.setTextSize(2);
//-----------------
switch (numc) {
case 1 :
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d1);
tft.setCursor(147, 29);
tft.print(h1);
tft.setCursor(173, 29);
tft.print(m1);
tft.setCursor(202, 29);
tft.print(s1);
break;
case 2:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d2);
tft.setCursor(147, 29);
tft.print(h2);
tft.setCursor(173, 29);
tft.print(m2);
tft.setCursor(202, 29);
tft.print(s2);
break;
case 3:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d3);
tft.setCursor(147, 29);
tft.print(h3);
tft.setCursor(173, 29);
tft.print(m3);
tft.setCursor(202, 29);
tft.print(s3);
break;
case 4:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d4);
tft.setCursor(147, 29);
tft.print(h4);
tft.setCursor(173, 29);
tft.print(m4);
tft.setCursor(202, 29);
tft.print(s4);
break;
case 5:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d5);
tft.setCursor(147, 29);
tft.print(h5);
tft.setCursor(173, 29);
tft.print(m5);
tft.setCursor(202, 29);
tft.print(s5);
break;
case 6:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d6);
tft.setCursor(147, 29);
tft.print(h6);
tft.setCursor(173, 29);
tft.print(m6);
tft.setCursor(202, 29);
tft.print(s6);
break;
case 7:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d7);
tft.setCursor(147, 29);
tft.print(h7);
tft.setCursor(173, 29);
tft.print(m7);
tft.setCursor(202, 29);
tft.print(s7);
break;
case 8:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d8);
tft.setCursor(147, 29);
tft.print(h8);
tft.setCursor(173, 29);
tft.print(m8);
tft.setCursor(202, 29);
tft.print(s8);
break;
case 9:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d9);
tft.setCursor(147, 29);
tft.print(h9);
tft.setCursor(173, 29);
tft.print(m9);
tft.setCursor(202, 29);
tft.print(s9);
break;
case 10:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d10);
tft.setCursor(147, 29);
tft.print(h10);
tft.setCursor(173, 29);
tft.print(m10);
tft.setCursor(202, 29);
tft.print(s10);
break;
case 11:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d11);
tft.setCursor(147, 29);
tft.print(h11);
tft.setCursor(173, 29);
tft.print(m11);
tft.setCursor(202, 29);
tft.print(s11);
break;
case 12:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d12);
tft.setCursor(147, 29);
tft.print(h12);
tft.setCursor(173, 29);
tft.print(m12);
tft.setCursor(202, 29);
tft.print(s12);
break;
}
}
if (x > 14 && x < 40 && y > 1 && y < 30 ) {
switch (numc) {
case 1:
e1 = true;
break;
case 2:
e2 = true;
break;
case 3:
e3 = true;
break;
case 4:
e4 = true;
break;
case 5:
e5 = true;
break;
case 6:
e6 = true;
break;
case 7:
e7 = true;
break;
case 8:
e8 = true;
break;
case 9:
e9 = true;
break;
case 10:
e10 = true;
break;
case 11:
e11 = true;
break;
case 12:
e12 = true;
break;
}
}
if (x > 44 && x < 70 && y > 1 && y < 30 ) {
switch (numc) {
case 1:
e1 = false;
break;
case 2:
e2 = false;
break;
case 3:
e3 = false;
break;
case 4:
e4 = false;
break;
case 5:
e5 = false;
break;
case 6:
e6 = false;
break;
case 7:
e7 = false;
break;
case 8:
e8 = false;
break;
case 9:
e9 = false;
break;
case 10:
e10 = false;
break;
case 11:
e11 = false;
break;
case 12:
e12 = false;
break;
}
}
if (x > 120 && x < 141 && y > 12 && y < 27 ) {
tm = 1;
}
if (x > 146 && x < 165 && y > 12 && y < 27 ) {
tm = 2;
}
if (x > 170 && x < 189 && y > 12 && y < 27 ) {
tm = 3;
}
//----------------------------------- STEP //57
if (x > 64 && x < 121 && y > 44 && y < 88 ) {
//...---...---.--.--.-.-.-.-
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
}
//-----------------
//----------------------------------PROG
if (x > 7 && x < 52 && y > 94 && y < 141 ) {
//._._._._._._._._._._._._._._._._._._._._.
}
//----------------------------------- -
if (x > 124 && x < 169 && y > 46 && y < 88 ) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(10, 5);
tft.print("Can.");
tft.setCursor(55, 5);
tft.print(numc);
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(1);
tft.setCursor(128, 20);
tft.print("D");
tft.setCursor(150, 20);
tft.print("H");
tft.setCursor(176, 20);
tft.print("M");
tft.setCursor(205, 20);
tft.print("S");
tft.setTextSize(2);
if (numc == 1) {
if ( tm == 1 ) {
if (d1 > 0) {
d1--;
}
}
if ( tm == 2 ) {
if (h1 > 0) {
h1--;
}
}
if ( tm == 3 ) {
if (m1 > 0) {
m1--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d1);
tft.setCursor(147, 29);
tft.print(h1);
tft.setCursor(173, 29);
tft.print(m1);
tft.setCursor(202, 29);
tft.print(s1);
}
if (numc == 2) {
if ( tm == 1 ) {
if (d2 > 0) {
d2--;
}
}
if ( tm == 2 ) {
if (h2 > 0) {
h2--;
}
}
if ( tm == 3 ) {
if (m2 > 0) {
m2--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d2);
tft.setCursor(147, 29);
tft.print(h2);
tft.setCursor(173, 29);
tft.print(m2);
tft.setCursor(202, 29);
tft.print(s2);
}
if (numc == 3) {
if ( tm == 1 ) {
if (d3 > 0) {
d3--;
}
}
if ( tm == 2 ) {
if (h3 > 0) {
h3--;
}
}
if ( tm == 3 ) {
if (m3 > 0) {
m3--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d3);
tft.setCursor(147, 29);
tft.print(h3);
tft.setCursor(173, 29);
tft.print(m3);
tft.setCursor(202, 29);
tft.print(s3);
}
if (numc == 4) {
if ( tm == 1 ) {
if (d4 > 0) {
d4--;
}
}
if ( tm == 2 ) {
if (h4 > 0) {
h4--;
}
}
if ( tm == 3 ) {
if (m4 > 0) {
m4--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d4);
tft.setCursor(147, 29);
tft.print(h4);
tft.setCursor(173, 29);
tft.print(m4);
tft.setCursor(202, 29);
tft.print(s4);
}
if (numc == 5) {
if ( tm == 1 ) {
if (d5 > 0) {
d5--;
}
}
if ( tm == 2 ) {
if (h5 > 0) {
h5--;
}
}
if ( tm == 3 ) {
if (m5 > 0) {
m5--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d5);
tft.setCursor(147, 29);
tft.print(h5);
tft.setCursor(173, 29);
tft.print(m5);
tft.setCursor(202, 29);
tft.print(s5);
}
if (numc == 6) {
if ( tm == 1 ) {
if (d6 > 0) {
d6--;
}
}
if ( tm == 2 ) {
if (h6 > 0) {
h6--;
}
}
if ( tm == 3 ) {
if (m6 > 0) {
m6--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d6);
tft.setCursor(147, 29);
tft.print(h6);
tft.setCursor(173, 29);
tft.print(m6);
tft.setCursor(202, 29);
tft.print(s6);
}
if (numc == 7) {
if ( tm == 1 ) {
if (d7 > 0) {
d7--;
}
}
if ( tm == 2 ) {
if (h7 > 0) {
h7--;
}
}
if ( tm == 3 ) {
if (m7 > 0) {
m7--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d7);
tft.setCursor(147, 29);
tft.print(h7);
tft.setCursor(173, 29);
tft.print(m7);
tft.setCursor(202, 29);
tft.print(s7);
}
if (numc == 8) {
if ( tm == 1 ) {
if (d8 > 0) {
d8--;
}
}
if ( tm == 2 ) {
if (d12 > 0) {
h8--;
}
}
if ( tm == 3 ) {
if (d12 > 0) {
m8--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d8);
tft.setCursor(147, 29);
tft.print(h8);
tft.setCursor(173, 29);
tft.print(m8);
tft.setCursor(202, 29);
tft.print(s8);
}
if (numc == 9) {
if ( tm == 1 ) {
if (d9 > 0) {
d9--;
}
}
if ( tm == 2 ) {
if (h9 > 0) {
h9--;
}
}
if ( tm == 3 ) {
if (m9 > 0) {
m9--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d9);
tft.setCursor(147, 29);
tft.print(h9);
tft.setCursor(173, 29);
tft.print(m9);
tft.setCursor(202, 29);
tft.print(s9);
}
if (numc == 10) {
if ( tm == 1 ) {
if (d10 > 0) {
d10--;
}
}
if ( tm == 2 ) {
if (h10 > 0) {
h10--;
}
}
if ( tm == 3 ) {
if (m10 > 0) {
m10--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d10);
tft.setCursor(147, 29);
tft.print(h10);
tft.setCursor(173, 29);
tft.print(m10);
tft.setCursor(202, 29);
tft.print(s10);
}
if (numc == 11) {
if ( tm == 1 ) {
if (d11 > 0) {
d11--;
}
}
if ( tm == 2 ) {
if (h11 > 0) {
h11--;
}
}
if ( tm == 3 ) {
if (m11 > 0) {
m11--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d11);
tft.setCursor(147, 29);
tft.print(h11);
tft.setCursor(173, 29);
tft.print(m11);
tft.setCursor(202, 29);
tft.print(s11);
}
if (numc == 12) {
if ( tm == 1 ) {
if (d12 > 0) {
d12--;
}
}
if ( tm == 2 ) {
if (h12 > 0) {
h12--;
}
}
if ( tm == 3 ) {
if (m12 > 0) {
m12--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d12);
tft.setCursor(147, 29);
tft.print(h12);
tft.setCursor(173, 29);
tft.print(m12);
tft.setCursor(202, 29);
tft.print(s12);
}
delay(400);
}
//----------------------------------- +
if (x > 182 && x < 227 && y > 46 && y < 88 ) {
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_2, LOW);
digitalWrite(pinRele_3, LOW);
//-----------------
puntoX = 182; puntoY = 46;
delay(400);
if (numc == 1) {
if ( tm == 1 ) {
d1++;
}
delay(50);
if ( tm == 2 ) {
h1++;
}
delay(50);
if ( tm == 3 ) {
m1++;
}
delay(50);
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d1);
tft.setCursor(147, 29);
tft.print(h1);
tft.setCursor(173, 29);
tft.print(m1);
tft.setCursor(202, 29);
tft.print(s1);
}
if (numc == 2) {
if ( tm == 1 ) {
d2++;
}
if ( tm == 2 ) {
h2++;
}
if ( tm == 3 ) {
m2++;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d2);
tft.setCursor(147, 29);
tft.print(h2);
tft.setCursor(173, 29);
tft.print(m2);
tft.setCursor(202, 29);
tft.print(s2);
}
if (numc == 3) {
if ( tm == 1 ) {
d3++;
}
if ( tm == 2 ) {
h3++;
}
if ( tm == 3 ) {
m3++;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d3);
tft.setCursor(147, 29);
tft.print(h3);
tft.setCursor(173, 29);
tft.print(m3);
tft.setCursor(202, 29);
tft.print(s3);
}
if (numc == 4) {
if ( tm == 1 ) {
d4++;
}
if ( tm == 2 ) {
h4++;
}
if ( tm == 3 ) {
m4++;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d4);
tft.setCursor(147, 29);
tft.print(h4);
tft.setCursor(173, 29);
tft.print(m4);
tft.setCursor(202, 29);
tft.print(s4);
}
if (numc == 5) {
if ( tm == 1 ) {
d5++;
}
if ( tm == 2 ) {
h5++;
}
if ( tm == 3 ) {
m5++;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d5);
tft.setCursor(147, 29);
tft.print(h5);
tft.setCursor(173, 29);
tft.print(m5);
tft.setCursor(202, 29);
tft.print(s5);
}
if (numc == 6) {
if ( tm == 1 ) {
d6++;
}
if ( tm == 2 ) {
h6++;
}
if ( tm == 3 ) {
m6++;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d6);
tft.setCursor(147, 29);
tft.print(h6);
tft.setCursor(173, 29);
tft.print(m6);
tft.setCursor(202, 29);
tft.print(s6);
}
if (numc == 7) {
if ( tm == 1 ) {
d7++;
}
if ( tm == 2 ) {
h7++;
}
if ( tm == 3 ) {
m7++;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d7);
tft.setCursor(147, 29);
tft.print(h7);
tft.setCursor(173, 29);
tft.print(m7);
tft.setCursor(202, 29);
tft.print(s7);
}
if (numc == 8) {
if ( tm == 1 ) {
d8++;
}
if ( tm == 2 ) {
h8++;
}
if ( tm == 3 ) {
m8++;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d8);
tft.setCursor(147, 29);
tft.print(h8);
tft.setCursor(173, 29);
tft.print(m8);
tft.setCursor(202, 29);
tft.print(s8);
}
if (numc == 9) {
if ( tm == 1 ) {
d9++;
}
if ( tm == 2 ) {
h9++;
}
if ( tm == 3 ) {
m9++;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d9);
tft.setCursor(147, 29);
tft.print(h9);
tft.setCursor(173, 29);
tft.print(m9);
tft.setCursor(202, 29);
tft.print(s9);
}
if (numc == 10) {
if ( tm == 1 ) {
d10++;
}
if ( tm == 2 ) {
h10++;
}
if ( tm == 3 ) {
m10++;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d10);
tft.setCursor(147, 29);
tft.print(h10);
tft.setCursor(173, 29);
tft.print(m10);
tft.setCursor(202, 29);
tft.print(s10);
}
if (numc == 11) {
if ( tm == 1 ) {
d11++;
}
if ( tm == 2 ) {
h11++;
}
if ( tm == 3 ) {
m11++;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d11);
tft.setCursor(147, 29);
tft.print(h11);
tft.setCursor(173, 29);
tft.print(m11);
tft.setCursor(202, 29);
tft.print(s11);
}
if (numc == 12) {
if ( tm == 1 ) {
d12++;
}
if ( tm == 2 ) {
h12++;
}
if ( tm == 3 ) {
m12++;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d12);
tft.setCursor(147, 29);
tft.print(h12);
tft.setCursor(173, 29);
tft.print(m12);
tft.setCursor(202, 29);
tft.print(s12);
}
}
//----------------------------------- VAC
if (x > 66 && x < 121 && y > 94 && y < 141 ) {
//-----------------r
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_2, LOW);
digitalWrite(pinRele_3, LOW);
//-----------------
puntoX = 64 ; puntoY = 93;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- - // RPD
if (x > 120 && x < 240 && y > 85 && y < 138 ) {
//-----------------
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_2, LOW);
digitalWrite(pinRele_3, LOW);
//-----------------
puntoX = 122; puntoY = 93;
imagenBoton();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------AS
if (x > 7 && x < 52 && y > 151 && y < 190 ) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
//-----------------
puntoX = 7; puntoY = 139;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- MS
if (x > 66 && x < 121 && y > 151 && y < 190 ) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
//-----------------
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_2, LOW);
digitalWrite(pinRele_3, LOW);
//-----------------
puntoX = 66; puntoY = 139;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- - // ENTER
if (x > 130 && x < 230 && y > 152 && y < 180 ) {
//-----------------
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_2, LOW);
digitalWrite(pinRele_3, LOW);
//-----------------
tft.fillRoundRect(7, 20, 227, 25, 2, ILI9341_DARKGREEN);
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(100, 25);
tft.print("Seguro?");
tft.setCursor(20, 25);
tft.setTextSize(2);
tft.setTextColor(ILI9341_GREEN, ILI9341_DARKGREEN);
tft.print("Si");
tft.setTextSize(2);
tft.setCursor(50, 25);
tft.setTextColor(ILI9341_RED, ILI9341_DARKGREEN);
tft.print("No");
x = 0; y = 0;
puntoX = 130; puntoY = 152;
//-----------------
}
//----------------------------------CLOCK
if (x > 7 && x < 52 && y > 185 && y < 212 ) {
//-----------------
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(10, 5);
tft.print("Can.");
tft.setCursor(55, 5);
tft.print(numc);
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(1);
tft.setCursor(128, 20);
tft.print("D");
tft.setCursor(150, 20);
tft.print("H");
tft.setCursor(176, 20);
tft.print("M");
tft.setCursor(205, 20);
tft.print("S");
tft.setTextSize(2);
//-----------------
switch (numc) {
case 1:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d1);
tft.setCursor(147, 29);
tft.print(h1);
tft.setCursor(173, 29);
tft.print(m1);
tft.setCursor(202, 29);
tft.print(s1);
break;
case 2:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d2);
tft.setCursor(147, 29);
tft.print(h2);
tft.setCursor(173, 29);
tft.print(m2);
tft.setCursor(202, 29);
tft.print(s2);
break;
case 3:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d3);
tft.setCursor(147, 29);
tft.print(h3);
tft.setCursor(173, 29);
tft.print(m3);
tft.setCursor(202, 29);
tft.print(s3);
break;
case 4:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d4);
tft.setCursor(147, 29);
tft.print(h4);
tft.setCursor(173, 29);
tft.print(m4);
tft.setCursor(202, 29);
tft.print(s4);
break;
case 5:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d5);
tft.setCursor(147, 29);
tft.print(h5);
tft.setCursor(173, 29);
tft.print(m5);
tft.setCursor(202, 29);
tft.print(s5);
break;
case 6:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d6);
tft.setCursor(147, 29);
tft.print(h6);
tft.setCursor(173, 29);
tft.print(m6);
tft.setCursor(202, 29);
tft.print(s6);
break;
case 7:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d7);
tft.setCursor(147, 29);
tft.print(h7);
tft.setCursor(173, 29);
tft.print(m7);
tft.setCursor(202, 29);
tft.print(s7);
break;
case 8:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d8);
tft.setCursor(147, 29);
tft.print(h8);
tft.setCursor(173, 29);
tft.print(m8);
tft.setCursor(202, 29);
tft.print(s8);
break;
case 9:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d9);
tft.setCursor(147, 29);
tft.print(h9);
tft.setCursor(173, 29);
tft.print(m9);
tft.setCursor(202, 29);
tft.print(s9);
break;
case 10:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d10);
tft.setCursor(147, 29);
tft.print(h10);
tft.setCursor(173, 29);
tft.print(m10);
tft.setCursor(202, 29);
tft.print(s10);
break;
case 11:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d11);
tft.setCursor(147, 29);
tft.print(h11);
tft.setCursor(173, 29);
tft.print(m11);
tft.setCursor(202, 29);
tft.print(s11);
break;
case 12:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(125, 29);
tft.print(d12);
tft.setCursor(147, 29);
tft.print(h12);
tft.setCursor(173, 29);
tft.print(m12);
tft.setCursor(202, 29);
tft.print(s12);
break;
}
//-----------------
}
//----------------------------------- ST
if (x > 64 && x < 121 && y > 185 && y < 212 ) {
}
//----------------------------------- - DD
if (x > 124 && x < 169 && y > 185 && y < 212 ) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
//-----------------
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_2, LOW);
digitalWrite(pinRele_3, LOW);
//-----------------
puntoX = 124; puntoY = 185;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- DO
if (x > 182 && x < 227 && y > 185 && y < 212 ) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
//-----------------
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_2, LOW);
digitalWrite(pinRele_3, LOW);
//-----------------
puntoX = 182; puntoY = 185;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------ROTATE
if (x > 7 && x < 52 && y > 230 && y < 275 ) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
//-----------------
if (numc <= 12) {
numc = numc + 1;
}
if ( numc == 13) {
numc = 1;
}
puntoX = 7; puntoY = 230;
imagenBoton1();
imagenInterfaz();
delay(400);
//-----------------
}
//----------------------------------- RAISE
if (x > 64 && x < 121 && y > 230 && y < 275 ) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
//-----------------
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_2, LOW);
digitalWrite(pinRele_3, LOW);
//-----------------
puntoX = 64; puntoY = 230;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- - // LOWER
if (x > 124 && x < 169 && y > 230 && y < 275 ) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
//-----------------
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_2, LOW);
digitalWrite(pinRele_3, LOW);
//-----------------
puntoX = 124; puntoY = 230;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- GO TO
if (x > 182 && x < 227 && y > 230 && y < 275 ) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
//-----------------
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_2, LOW);
digitalWrite(pinRele_3, LOW);
//-----------------
puntoX = 182; puntoY = 230;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------CF
if (x > 7 && x < 52 && y > 280 && y < 355 ) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
//-----------------
puntoX = 7; puntoY = 275;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- ES
if (x > 64 && x < 150 && y > 280 && y < 355 ) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
//-----------------
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_3, LOW);
//-----------------
puntoX = 64; puntoY = 275;
imagenBoton3();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- CA
if (x > 153 && x < 300 && y > 280 && y < 355 ) {
tft.fillRoundRect(7, 0, 229, 45, 2, ILI9341_DARKGREEN);
//-----------------
digitalWrite(pinRele_1, LOW);
digitalWrite(pinRele_2, LOW);
digitalWrite(pinRele_3, LOW);
//-----------------
puntoX = 152; puntoY = 275;
imagenBoton3();
delay(400);
imagenInterfaz();
}
}//FIN tft.getTouch
}
//------------------------------------------------------------------------------------------
//REFRESCO DE DISPLAY
void imagenInterfaz() {
tft.pushImage(0, 0, animation_width, animation_height, frame);
}
//------------------------------------------------------------------------------------------
I told you it was long, I have the other file which is the .h file but there are only hexadecimal to make an image appear on the screen