Go Down

Topic: 3.2 TFT GLCD, Touch Screen with Arduino Mega Control Screen (Read 877 times) previous topic - next topic


I have been having some issues trying to get the buttons on the touch screen to work, currently I have 2 versions of the code. The first one using if statements and the second one using switch/case statements, both of which yield the same result which is only displaying a message expected to happen when buttons aren't pressed.  Any help would be appreciated on getting the buttons to work when pressed. Sorry about the long post given the attached code.



Had a quick look and both solutions should do something .. Fairly sure problem steams from fact that.. If no touch your

while (true)  ... loop has nothing so compiler optimizes this ode route to no operation, register only  looping, had similar situation myself.

Now although I am not a fan of the UTFT touch library it does work provided the linearity of your display is within his default requirement. .. The code for detecting touch  will try and activate but the way UTouch detects touch will be crippled by your loop skipping round making it nearly impossible for the touch library code to set available.

Simple way of proving this hypothesis, stickl a delay(2) in the else clause of touch available so in a no touch situation your loop delays and yields to the touch library code allowing it to set the available flag..

I posted previously some outline code handling initial touch detection by Interrupt thereby eliminating this type of situation..

Happy coding   8) 8)

Go Up