Pages: [1]   Go Down
Author Topic: Interrupting IF statement  (Read 354 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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



Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

California
Online Online
Faraday Member
**
Karma: 88
Posts: 3375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?".
Logged

Pages: [1]   Go Up
Jump to: