bonjour j'essaie depuis un bon moment j'en suis arriver a sa qlq pourrait m'aider a faire les sous menu puis pouvoir les changé les valeur
voici mon code
#include <UTFTGLUE.h>
#include <TouchScreen.h>
UTFTGLUE myGLCD(0, A2, A1, A3, A4, A0);
#define TS_MINX 150
#define TS_MINY 130
#define TS_MAXX 3800
#define TS_MAXY 4000
TouchScreen ts = TouchScreen(8, A3, A2, 9, 300); //XP = 8, XM = A2, YP = A3, YM = 9
void setup() {
myGLCD.InitLCD();
myGLCD.setFont(BigFont);
myGLCD.clrScr();
myGLCD.setColor(255, 255, 255);
myGLCD.setBackColor(0, 0, 0);
myGLCD.print("Parametres", CENTER, 20);
int rectWidth = (myGLCD.getDisplayXSize() - 50) / 2;
int rectHeight = 60;
int rectSpacing = 15;
int startY = 110;
// Draw and label the rectangles
int rect1Left = 20;
int rect1Top = startY;
int rect1Right = rect1Left + rectWidth;
int rect1Bottom = rect1Top + rectHeight;
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(rect1Left, rect1Top, rect1Right, rect1Bottom);
myGLCD.setColor(255, 255, 255);
myGLCD.drawRect(rect1Left, rect1Top, rect1Right, rect1Bottom);
myGLCD.print("Luminosite", rect1Left + 10, rect1Top + (rectHeight / 2) - 10);
int rect2Left = rect1Right + rectSpacing;
int rect2Top = startY;
int rect2Right = rect2Left + rectWidth;
int rect2Bottom = rect2Top + rectHeight;
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(rect2Left, rect2Top, rect2Right, rect2Bottom);
myGLCD.setColor(255, 255, 255);
myGLCD.drawRect(rect2Left, rect2Top, rect2Right, rect2Bottom);
myGLCD.print("Humidite", rect2Left + 10, rect2Top + (rectHeight / 2) - 10);
int rect3Left = 20;
int rect3Top = rect1Bottom + rectSpacing;
int rect3Right = rect3Left + rectWidth;
int rect3Bottom = rect3Top + rectHeight;
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(rect3Left, rect3Top, rect3Right, rect3Bottom);
myGLCD.setColor(255, 255, 255);
myGLCD.drawRect(rect3Left, rect3Top, rect3Right, rect3Bottom);
myGLCD.print("Date/Heure", rect3Left + 10, rect3Top + (rectHeight / 2) - 10);
int rect4Left = rect3Right + rectSpacing;
int rect4Top = rect2Bottom + rectSpacing;
int rect4Right = rect4Left + rectWidth;
int rect4Bottom = rect4Top + rectHeight;
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(rect4Left, rect4Top, rect4Right, rect4Bottom);
myGLCD.setColor(255, 255, 255);
myGLCD.drawRect(rect4Left, rect4Top, rect4Right, rect4Bottom);
myGLCD.print("Manuel", rect4Left + 10, rect4Top + (rectHeight / 2) - 10);
}
void loop() {
TSPoint touch = ts.getPoint();
int touchX = map(touch.x, TS_MINX, TS_MAXX, 0, myGLCD.getDisplayXSize());
int touchY = map(touch.y, TS_MINY, TS_MAXY, 0, myGLCD.getDisplayYSize());
int rectWidth = (myGLCD.getDisplayXSize() - 50) / 2;
int rectHeight = 60;
int rectSpacing = 15;
int startY = 110;
if (touch.z > 1) {
// Check if touch is inside the first rectangle
if (touchX > 20 && touchX < 20 + rectWidth && touchY > startY && touchY < startY + rectHeight) {
// Add your code for adjusting screen brightness here
}
// Add your code for the other rectangles here
delay(2000); // Wait for 2 seconds
}
}