Go Down

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


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


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.


How to use this forum

Most notably, these parts:

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.

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

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131