Hi
I have the following code. This is partial code being used on a controller on a 3.2" tft screen using an Arduino mega.
There are 2 arrows, up and down for changing the value in the box at these coords. If I touch the "amount" at another location I want to use the same up and down arrow but alter that amount instead.
It won't change focus from the first amount I touched until I exit the screen and go back in again.
What have I missed adding please?
if (Enter_new_dose == true){
if((y >= 217) && (y <= 252)){ // two y-coordinates (142/169)
if ((x >= 66) && (x <= 98)){ // Down Button by 1's
waitForIt(66, 217, 98, 251);
if (change_dose == 1){
if (Pump1dose > 0){
Pump1dose -= 1;
x=0;
y=0;
if (Pump1dose <= 9){
myGLCD.setFont(arial_bold);
myGLCD.setBackColor(255,255,255);
myGLCD.print(" ", 63, 39); //Clear Number for less digits
}
}
}
if(change_dose == 2){
if (Pump2dose > 0){
Pump2dose -= 1;
x=0;
y=0;
if (Pump2dose <= 9){
myGLCD.setFont(arial_bold);
myGLCD.setBackColor(255,255,255);
myGLCD.print(" ", 186, 39); //Clear Number for less digits
}
}
}
if (change_dose == 3){
if (Pump3dose > 0){
Pump3dose -= 1;
x=0;
y=0;
if (Pump3dose <= 9){
myGLCD.setFont(arial_bold);
myGLCD.setBackColor(255,255,255);
myGLCD.print(" ", 63, 139); //Clear Number for less digits
}
}
}
if (change_dose == 4){
if (ATO > 0){
ATO -= 1;
x=0;
y=0;
if (ATO <= 9){
myGLCD.setFont(arial_bold);
myGLCD.setBackColor(255,255,255);
myGLCD.print(" ", 186, 139); //Clear Number for less digits
}
}
}
Print_DoseAmount();
}
if ((x >= 102) && (x <= 134)){
waitForIt (102, 217, 134, 251);
if (change_dose == 1){
if (Pump1dose >= 0){
Pump1dose += 1;
x=0;
y=0;
}
}
if(change_dose == 2){
if (Pump2dose >= 0){
Pump2dose += 1;
x=0;
y=0;
}
}
if (change_dose == 3){
if (Pump3dose >= 0){
Pump3dose += 1;
x=0;
y=0;
}
}
if (change_dose == 4){
if (ATO >= 0){
ATO += 1;
x=0;
y=0;
}
}
}
Print_DoseAmount();
}
}


