Hi there,
Is it possible to trigger an if statement with a button, if it's possible please help. On my design project I want the the set of code to exist if only I press the button and if the button is not pressed it should not be executed, please help I have 4 days left to present my project and it's incomplete. Here is the code that I want to control with the push button:
if(int(flowRate) > 4)
{
digitalWrite(SolePin, High);
led.setCursor(1, 0);
led.print(''Warning'');
}
I want this action to happen if the button is pressed, please help, 
Buttons are normally just open or closed, so a HIGH or LOW value is returned.
If you have this in setup:
void setup(){
pinMode(buttonPin, INPUT_PULLUP); // button connects pin to GND when pressed
} // end setup
Then in loop you can do this:
void loop(){
if (digitalRead(buttonPin) == LOW){
// button is pressed, do something
}
else { // button is HIGH
// button is not pressed, do something else
}
} // end loop
Don't forget you also need to debounce the button (or have a long enough delay between reads) that you don't get hit with multiple button presses when you push the button and the contacts bounce (as most buttons do).
Thank you guys,
I presented my problem incorrectly, What I needed is that, is it possible to have a if statement that has two conditional statements on it, ie, if(a==0; B==0) { // code to be executed if both A and B conditions are true}, The first condition will be based on the button and the second one will be on the my system.
Hi guys,
Is it possible to have an if statement that has two conditional statements on it, i.e if(A==0; B==0) { // code to be executed if both conditions within the bracket are true}, The first condition will be based on the button and the second one will be on the my system.
http://forum.arduino.cc/index.php?topic=45372.0
They already answered the question. 
I think that with OR it should be something like "||" instead of the "&&" but I'm new to arduino IDE so I'm not sure. 
Hope that helps.
Replied to your other thread with the same Question.
https://forum.arduino.cc/index.php?topic=435528.0