I know it is a bit confusing but I get this error in my code, is not an uploading error of course, but when I go to test it, it just doesn't work. 1 month has passed and I still don't know why on earth this error is still happening.
The components are an ILI9341 and an esp32, The project consists of 12 different containers filled up with liquids, and each container has an adjustable timer, for example: In container 1 I want to put a timer of 2 days, 4 hours 36 minutes, and 30 seconds, for container 2 the timer will be 4 hours, 23 minutes, and 0 seconds, when the user finished to set up all the 12 timers, he will press a button to start the countdown, and when all containers reached 0, it just stops and sends an alarm (the alarm is just showing a text on the screen).
The code:
#include "FS.h"
#include <TFT_eSPI.h> // Hardware-specific library
TFT_eSPI tft = TFT_eSPI();
#include "teclado.h"
#include <Adafruit_GFX.h>
#include <Wire.h>
#include <Adafruit_ILI9341.h>
#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
//-------------------RELE------------------------------
void touchInterfaz();
void imagenInterfaz();
void imagenBoton();
int numc = 1;
//3333333 2222222 0000000 22222222 44 44 0000000
// 33 22 00 00 X X 22 44 44 00 00
//3333333 2222222 00 00 X 22222222 444444444 00 00
// 33 22 00 00 X X 22 44 00 00
//3333333 2222222 0000000 22222222 44 0000000
int m1 = 00;
int m2 = 00;
int m3 = 00;
int m4 = 00;
int m5 = 00;
int m6 = 00;
int m7 = 00;
int m8 = 00;
int m9 = 00;
int m10 = 00;
int m11 = 00;
int m12 = 00;
int h1 = 00;
int h2 = 00;
int h3 = 00;
int h4 = 00;
int h5 = 00;
int h6 = 00;
int h7 = 00;
int h8 = 00;
int h9 = 00;
int h10 = 00;
int h11 = 00;
int h12 = 00;
int d1 = 00;
int d2 = 00;
int d3 = 00;
int d4 = 00;
int d5 = 00;
int d6 = 00;
int d7 = 00;
int d8 = 00;
int d9 = 00;
int d10 = 00;
int d11 = 00;
int d12 = 00;
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;
int tm = 0;
bool estado[12] = {false, false, false, false, false, false, false, false, false, false, false, false};
String dp = ":";
//****************************************************************************************
void setup() {
Serial.begin(9600);
//----------------------------------------------------
pinMode(ledWifi, OUTPUT);
digitalWrite(ledWifi, HIGH);
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(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
}
//******************************************************************************************
void touchInterfaz(
String &s1, String &s2, String &s3, String &s4,
String &s5, String &s6, String &s7, String &s8,
String &s9, String &s10, String &s11, String &s12
);
void loop() {
String strg1 = String(d1) + ":" + String(h1) + ":" + String( m1);
String strg2 = String(d2) + ":" + String(h2) + ":" + String( m2);
String strg3 = String(d3) + ":" + String(h3) + ":" + String( m3);
String strg4 = String(d4) + ":" + String(h4) + ":" + String( m4);
String strg5 = String(d5) + ":" + String(h5) + ":" + String( m5);
String strg6 = String(d6) + ":" + String(h6) + ":" + String( m6);
String strg7 = String(d7) + ":" + String(h7) + ":" + String( m7);
String strg8 = String(d8) + ":" + String(h8) + ":" + String( m8);
String strg9 = String(d9) + ":" + String(h9) + ":" + String( m9);
String strg10 = String(d10) + ":" + String(h10) + ":" + String(m10);
String strg11 = String(d11) + ":" + String(h11) + ":" + String(m11);
String strg12 = String(d12) + ":" + String(h12) + ":" + String(m12);
touchInterfaz(strg1, strg2, strg3, strg4, strg5, strg6, strg7, strg8, strg9, strg10, strg11, strg12);
}
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(String &strg1, String &strg2, String &strg3, String &strg4, String &strg5, String &strg6, String &strg7, String &strg8, String &strg9, String &strg10, String &strg11, String &strg12) {
if (tft.getTouch(&x, &y))
{ //20, 25 135, 25
//----------------------------------- RESET
if (x > 7 && x < 52 && y > 44 && y < 88) {
tft.fillRoundRect(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
d1 = 0;
d2 = 0;
d3 = 0;
d4 = 0;
d5 = 0;
d6 = 0; //DECLARATION OF VARIABLES
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;
m5 = 0;
m6 = 0;
m7 = 0;
m8 = 0;
m9 = 0;
m10 = 0;
m11 = 0;
m12 = 0;
tft.fillRoundRect(0, 0, 240, 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(194, 20);
tft.print("D");
tft.setCursor(168, 20);
tft.print("H");
tft.setCursor(194, 20);
tft.print("M");
tft.setTextSize(2);
//-----------------
//OUTPUT FOR EACH CONTAINER
switch (numc) {
case 1:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg1);
break;
case 2:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg1);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg2);
break;
case 3:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg2);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg3);
break;
case 4:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg3);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg4);
break;
case 5:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg4);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg5);
break;
case 6:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg5);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg6);
break;
case 7:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg6);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg7);
break;
case 8:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg7);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg8);
break;
case 9:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg8);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg9);
break;
case 10:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg9);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg10);
break;
case 11:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg10);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg11);
break;
case 12:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg11);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg12);
break;
}
}
if (x > 14 && x < 40 && y > 1 && y < 30 ) {
if (numc >= 1 && numc <= 12) estado[numc - 1] = true;
}
if (x > 44 && x < 70 && y > 1 && y < 30 ) {
if (numc >= 1 && numc <= 12) estado[numc - 1] = false;
}
if (x > 143 && x < 161 && y > 12 && y < 27 ) { tm = 1; }
if (x > 167 && x < 187 && y > 12 && y < 27 ) { tm = 2; }
if (x > 192 && x < 209 && y > 12 && y < 27 ) { tm = 3; }
//----------------------------------- STEP //57
if (x > 64 && x < 121 && y > 44 && y < 88 ) {
tft.fillRoundRect(0, 0, 240, 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(0, 0, 240, 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(146, 20);
tft.print("D");
tft.setCursor(168, 20);
tft.print("H");
tft.setCursor(194, 20);
tft.print("M");
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(145, 29);
tft.print(strg1);
}
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(145, 29);
tft.print(strg2);
}
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(145, 29);
tft.print(strg3);
}
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(145, 29);
tft.print(strg4);
}
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(145, 29);
tft.print(strg5);
}
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(145, 29);
tft.print(strg6);
}
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(145, 29);
tft.print(strg7);
}
if (numc == 8) {
if ( tm == 1 ) {
if (d8 > 0) {
d8--;
}
}
if ( tm == 2 ) {
if (d8 > 0) {
h8--;
}
}
if ( tm == 3 ) {
if (d8 > 0) {
m8--;
}
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg8);
}
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(145, 29);
tft.print(strg9);
}
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(145, 29);
tft.print(strg10);
}
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(145, 29);
tft.print(strg11);
}
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(145, 29);
tft.print(strg12);
}
delay(400);
}
//----------------------------------- +
if (x > 182 && x < 227 && y > 46 && y < 88 ) {
puntoX = 182; puntoY = 46;
delay(400);
if (numc == 1) {
if ( tm == 1 ) {
d1++;
d1 = d1 + 1 - 1;
}
if ( tm == 2 ) {
h1++;
h1 = h1 + 1 - 1;
}
if ( tm == 3 ) {
m1++;
m1 = m1 + 1 - 1;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg1);
}
if (numc == 2) {
if ( tm == 1 ) {
d2++;
d2 = d2 + 1 - 1;
}
if ( tm == 2 ) {
h2++;
h2 = h2 + 1 - 1;
}
if ( tm == 3 ) {
m2++;
m2 = m2 + 1 - 1;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg2);
}
if (numc == 3) {
if ( tm == 1 ) {
d3++;
d3 = d3 + 1 - 1;
}
if ( tm == 2 ) {
h3++;
h3 = h3 + 1 - 1;
}
if ( tm == 3 ) {
m3++;
d1 = d1 + 1 - 1;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg3);
}
if (numc == 4) {
if ( tm == 1 ) {
d4++;
d1 = d1 + 1 - 1;
}
if ( tm == 2 ) {
h4++;
h4 = h4 + 1 - 1;
}
if ( tm == 3 ) {
m4++;
m4 = m4 + 1 - 1;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg4);
}
if (numc == 5) {
if ( tm == 1 ) {
d5++;
d5 = d5 + 1 - 1;
}
if ( tm == 2 ) {
h5++;
h5 = h5 + 1 - 1;
}
if ( tm == 3 ) {
m5++;
m5 = m5 + 1 - 1;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg5);
}
if (numc == 6) {
if ( tm == 1 ) {
d6++;
d6 = d6 + 1 - 1;
}
if ( tm == 2 ) {
h6++;
h6 = h6 + 1 - 1;
}
if ( tm == 3 ) {
m6++;
m6 = m6 + 1 - 1;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg6);
}
if (numc == 7) {
if ( tm == 1 ) {
d7++;
d7 = d7 + 1 - 1;
}
if ( tm == 2 ) {
h7++;
h7 = h7 + 1 - 1;
}
if ( tm == 3 ) {
m7++;
m7 = m7 + 1 - 1;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg7);
}
if (numc == 8) {
if ( tm == 1 ) {
d8++;
d8 = d8 + 1 - 1;
}
if ( tm == 2 ) {
h8++;
h8 = h8 + 1 - 1;
}
if ( tm == 3 ) {
m8++;
m8 = m8 + 1 - 1;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg8);
}
if (numc == 9) {
if ( tm == 1 ) {
d9++;
d9 = d9 + 1 - 1;
}
if ( tm == 2 ) {
h9++;
h9 = h9 + 1 - 1;
}
if ( tm == 3 ) {
m9++;
m9 = m9 + 1 - 1;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg9);
}
if (numc == 10) {
if ( tm == 1 ) {
d10++;
d10 = d10 + 1 - 1;
}
if ( tm == 2 ) {
h10++;
h10 = h10 + 1 - 1;
}
if ( tm == 3 ) {
m10++;
m10 = m10 + 1 - 1;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg10);
}
if (numc == 11) {
if ( tm == 1 ) {
d11++;
d11 = d11 + 1 - 1;
}
if ( tm == 2 ) {
h11++;
h11 = h11 + 1 - 1;
}
if ( tm == 3 ) {
m11++;
h11 = h11 + 1 - 1;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg11);
}
if (numc == 12) {
if ( tm == 1 ) {
d12++;
d12 = d12 + 1 - 1;
}
if ( tm == 2 ) {
h12++;
h12 = h12 + 1 - 1;
}
if ( tm == 3 ) {
m12++;
m12 = m12 + 1 - 1;
}
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg12);
}
}
//----------------------------------- VAC
if (x > 66 && x < 121 && y > 94 && y < 141 ) {
//-----------------r
tft.fillRoundRect(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
//-----------------
puntoX = 64 ; puntoY = 93;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- - // RPD
if (x > 120 && x < 240 && y > 85 && y < 138 ) {
//-----------------
tft.fillRoundRect(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
//-----------------
puntoX = 122; puntoY = 93;
imagenBoton();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------AS
if (x > 7 && x < 52 && y > 151 && y < 190 ) {
tft.fillRoundRect(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
//-----------------
puntoX = 7; puntoY = 139;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- MS
if (x > 66 && x < 121 && y > 151 && y < 190 ) {
tft.fillRoundRect(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
puntoX = 66; puntoY = 139;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- - // ENTER
if (x > 130 && x < 230 && y > 152 && y < 180 ) {
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(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
x = 0;
y = 0;
tft.fillRoundRect(0, 0, 240, 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(146, 20);
tft.print("D");
tft.setCursor(168, 20);
tft.print("H");
tft.setCursor(194, 20);
tft.print("M");
tft.setTextSize(2);
//-----------------
switch (numc) {
case 1:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg1);
break;
case 2:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg1);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg2);
break;
case 3:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg2);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg3);
break;
case 4:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg3);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg4);
break;
case 5:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg4);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg5);
break;
case 6:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg5);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg6);
break;
case 7:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg6);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg7);
break;
case 8:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg7);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg8);
break;
case 9:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg8);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg9);
break;
case 10:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg9);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg10);
break;
case 11:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg10);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg11);
break;
case 12:
tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
tft.setCursor(10, 29);
tft.print(strg11);
tft.setTextSize(2);
tft.setCursor(145, 29);
tft.print(strg12);
break;
}
//-----------------
}
//----------------------------------- ST
if (x > 64 && x < 121 && y > 185 && y < 212 ) {
}
//----------------------------------- - DD
if (x > 124 && x < 169 && y > 185 && y < 212 ) {
tft.fillRoundRect(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
puntoX = 124; puntoY = 185;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- DO
if (x > 182 && x < 227 && y > 185 && y < 212 ) {
tft.fillRoundRect(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
puntoX = 182; puntoY = 185;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------ROTATE
if (x > 7 && x < 52 && y > 230 && y < 275 ) {
tft.fillRoundRect(0, 0, 240, 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(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
//-----------------
puntoX = 64; puntoY = 230;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//------------------------------------ // LOWER
if (x > 124 && x < 169 && y > 230 && y < 275 ) {
tft.fillRoundRect(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
//-----------------
puntoX = 124; puntoY = 230;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- GO TO
if (x > 182 && x < 227 && y > 230 && y < 275 ) {
tft.fillRoundRect(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
//-----------------
puntoX = 182; puntoY = 230;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------CF
if (x > 7 && x < 52 && y > 280 && y < 355 ) {
tft.fillRoundRect(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
//-----------------
puntoX = 7; puntoY = 275;
imagenBoton1();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- ES
if (x > 64 && x < 150 && y > 280 && y < 355 ) {
tft.fillRoundRect(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
puntoX = 64; puntoY = 275;
imagenBoton3();
delay(400);
imagenInterfaz();
//-----------------
}
//----------------------------------- CA
if (x > 153 && x < 300 && y > 280 && y < 355 ) {
tft.fillRoundRect(0, 0, 240, 45, 2, ILI9341_DARKGREEN);
//-----------------
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);
}
//------------------------------------------------------------------------------------------
Some names are in Spanish so that is the reason for those names, the problem with this code is that when I try to set up a value, for example, hours and put 5 on it when I change the container or move to set up another value the last value I set up, adds 1 into it, same for minutes if I put 3 or any other number it puts 4 when I change container or value, and if I want to put fewer days, minutes or hours, it quits -1 to the last value, this is freaking confusing for me