checking for different input values

Hi all

Was wondering if it was possible to have code that waited for a state change from different sensors THEN went to a particular part of the code to execute a routine, a bit like a GOSUB? I understand that many do not like the GOTO label: because of making debugging a prog difficult, but is there a way that works?

I believe you would want to use a function in the c++ code (arduino code), rather than a gosub (ends up working a about the same).

In place of your subroutine use a function. Call the function when ever you like. You can define your own functions.
There is absoloutly no need for a goto statement if you use the appropriate control statements.

Thank you. I will try and learn this one with research.