hi guys im beginner at ardunio im having a problem
this exactly what im working on
but when im ordring dish 1 its order dish 5
and when im ordring dish 2 its ordring other thing .. its messy
what should i do plz help this university project
and the code is here
The lines like this are what associates a messages with the area of the screen touched. If the numbers are wrong you will get the wrong button associated with each area of the screen.
You must come to enough of an understanding of how the hardware works, and how this program works, to be able to find and fix the problems you are having.
Write a small program that does nothing but serial print coordinates as you touch the screen.
As has been suggested, those numbers aren't working correctly with the way the code is interpreting them.
Just you and the touchscreen, until you are sure the corners are where the should be and the axes are not mirror, flipped or rotated.
It looks like SOMETHING is swapped. The "Dish1" button is drawn at (10, 30, 100, 40) and I assume that's X, Y, Width, Height. That would put the button between 10 and 110 in X and 30 and 70 in Y but the code for detecting a press on "Dish1" is using: p.x > 30 && p.x < 70 p.y > 130 && p.y < 230
That indicates that the X and Y axis are swapped between the graphics and the touchscreen and that one axis (X on graphics, Y on the touchscreen) is reversed.