Hello,
I'm don't post on forums much. I normally find answer on previous forums, yet I can't find my answer. I have some basic knowledge about coding Arduino. I'm not going to post my code but I need an example from you guys.
So in my setup I have push buttons that connect when pushed and disconnect when released.
My code will run the "if statement" if I hold down then button. But I want it to run the if statement all the way through just on a simple click of a button.
I also have another button that I want to be on a loop until another button is pressed. But I think I can figure that out.
I just need to know the right code example for if a click button is pushed to run the entire if statement.
If a test returns true then the whole code in the following code block will be executed whether that is a single line of code or many lines
So what constitutes a code block ?
In some programming languages a code block is defined by its lines of code being tabbed to the same level but not in C++, which is what the Arduino uses
The safest thing to do is to put the dependant code block in a pair of curly braces like this
if (this == true)
{
//execute the code here
}
If that is not what you are asking then please post an example sketch illustrating your problem