I used a certain void in my void loop but I need to sue other voids and it keeps using the first one. So, it’s for a touch shield and the first screen is working with three buttons but when we click on one, it keeps the localization of the three of the first screen (but on another screen).

Here’s the void loop :

void loop ()

{

chosen_btn_scrn1();

Point p = ts.getPoint();

p.x = map(p.x, TS_MINX, TS_MAXX, 0, 240);

p.y = map(p.y, TS_MINY, TS_MAXY, 0, 320);

if (chosen_button_screen1 == 50)

{

Tft.fillScreen(0, 419, 0, 419, WHITE); //white screen

draw_scrn2();

chosen_button_screen1 = 0;

butn_return ();

if (btn_return == -1)

{

Tft.fillScreen(0, 419, 0, 419, WHITE); //écran blanc

draw_scrn1();

btn_return = 0;

}

}

if (chosen_button_screen1 == 51)

{

Tft.fillScreen(0, 419, 0, 419, WHITE); //white screen

draw_scrn5();

chosen_button_screen1 = 0;

butn_return ();

}

if (chosen_button_screen1 == 52)

{

Tft.fillScreen(0, 419, 0, 419, WHITE); //white screen

draw_scrn6();

touche_choisie_screen1 = 0;

butn_return ();

}

And here’s the void chosen_btn_scrn1() :

void chosen_btn_scrn1()

{

Point p = ts.getPoint();

p.x = map(p.x, TS_MINX, TS_MAXX, 0, 240);

p.y = map(p.y, TS_MINY, TS_MAXY, 0, 320);

if ((p.z > __PRESURE) && (9 < p.x) && (p.x < 231) && (80 < p.y) && (p.y < 140)) // btn 1 pressed

{

chosen_btn_screen1 = 50;

}

if ((p.z > __PRESURE) && (9 < p.x) && (p.x < 231) && (190 < p.y) && (p.y < 250)) // btn 2 pressed

{

chosen_btn_screen1 = 51;

}

if ((p.z > __PRESURE) && (60 < p.x) && (p.x < 171) && (268 < p.y) && (p.y < 308)) // btn 3 pressed

{

chosen_btn_screen1 = 52;

}

}

Thanks for your help!