Michel Keijzers pointed out the issues you have in your code. But then
there is also an issue with your circuit: if you press any of the push
buttons, the analog input pin gets connected to one of the nodes of the
resistor ladder, and you get a well defined voltage reading. Good.
However, if none of the buttons is pressed, the input is not connected
You made a few mistakes with the three lines, first one being:
if (temp = 340)
First, the single '=' is an assignment operator instead of a comparing operator. You want to use '=='.
However, you need to check if it is within a range, so you need to use <= (to see if it is smaller or equal). Also you need to put them in the correct order, so you get ...
Try to use this command
input = Serial.readStringUntil('\n');
Instead of input = Serial.readString();
and also use while (Serial.available() > 0)
Instead of while (Serial.available()==0)
and where you used int switchLead = 0;
Try to use bool switchLead;
I hope these changes in the code will help you
Try to use MCUFriend kbv library I used this library for a 3.5 inch display and the driver on it was ILI9486 this library includes all the function and I have tested the touch also this library works good for it also