Go Down

Topic: Interrupting IF statement (Read 442 times) previous topic - next topic

zoom

Assume somewhere in the middle of the if statement, upon an input, I want to interrupt it.
How can I handle this ?




zoom

int check()
{
  if(digitalRead(9) == LOW)
  {
    return 0;
  }
}

this is the function and calling this function by writing down check(); statement whenever I want to check the condition to interrupt the if statement would work I think.
Don't have the board with me, so can't test. But this is my idea.

Arrch

How to use this forum

Most notably, these parts:

Quote
Post a complete sketch (program code)! If you don't you waste time while people ask you to do that. However, with coding problems, if possible post a "minimal" sketch that demonstrates the problem - not hundreds of lines of code. If the problem goes away in the minimal sketch, it wasn't where you thought it was.


Quote
If possible, describe what you are really trying to do, not what you think might work. For example "I am trying to turn on an aquarium heater and pump at the same time", not "how do I break out of an interrupt?".

Go Up