UTFT button problem, selects all buttons problem

Good day.

I am using an Arduino Due, several sensors (AM2315 and TSL2561) and a 3.2 inch TFT/Shield (Electric Freaks V2.2 shield and TFT_320QVT). I am using Arduino 1.6.5 on Linux Mint 17.2.

The UTFT button sketch works perfectly. I used this as the basis to make my project so far.

I can see and get results from each of the sensors. However, when I devote a button to each sensor/function (i.e. button for Rh and Temp, second button for Visible Light and third button for NIR) no matter which button I press all the button functions are activated and the displayed values work from the first through the last. If I press button three, I get the correct value for that button but only after the values for the first and second buttons are displayed.

I really don't know what I need to do to restrict the working function and displayed value(s) to just the button being pressed.

I have calibrated the TFT screen values properly and recorded them in the UTouchCD.h.

Here is the code, I have commented out the first button so as to be better able to troubleshoot the second and third buttons. But, when the first button code is uncommented, its values flash through at the first of the displayed values and text.

I tried putting the code in the body but it is too long. I have attached the .ino file

I have several days into error trapping this and I would appreciate any help. I have tried to search the forums and have not seen anything which really helps so far.

Thank you

Matadormac

UTFT_Buttons_320x240_Meter_Rh_3_Float_5_NoBuffer_3_Final_LightE.ino (11.2 KB)

You have no braces around your 'if' statements!!

When using if(...)

The correct format would be

if(...)
{
code
code
code
code
code
}

if you only have one line of code pertinent to the 'if' statement you can leave out the braces '{}'.

Regards,

Graham

Marvelous.

I feel a bit silly about that but it explains a lot. I won't be able to make these alterations until this evening and I will report back after that.

Thank you so very much.

Matadormac