It would, and does. If the body of your statement is not being executed, it is because the conditions are never such that the whole statement evaluates to true.
Thanks for the fast answer Paul.
But actually i cant compile my sketch when I implement the if statement above. Anyhow, I thought it would be some limitation of the IDE.
I guess I have to dig some deeper now that I know that this should work in principle.
Thanks for the help. I tried with the brackets, it would not compile either.
Here is the code I´m using:
boolean simpleThread_loop(THREAD_LEDBlink)
{
/* Loop Function */
if ((use_Relay_block == 1 && Relay_block == true) || (simpleThread_isRun(THREAD_InitControl) == true))
{
// take control over the LEDs
LED_control = 1;
// Dynamic Display showing a blinking call sign to signal user that relay is blocked
odd_even = !odd_even; // alternating operator used to display the call sign
if (odd_even){ // Even
digitalWrite(LEDPin_red, HIGH); // red LED off
}
else { // Odd
digitalWrite(LEDPin_red, LOW); // red LED off
}
}
else{
// Dont take control over the LEDs
LED_control = 0;
}
return true;
}
and that is the compiler error I get:
X_D_ThreadsFunctions.ino: In function 'boolean simpleThread_loop_THREAD_LEDBlink()':
X_D_ThreadsFunctions:377: error: expected `)' before ';' token
X_D_ThreadsFunctions:377: error: expected `)' before ';' token
X_D_ThreadsFunctions:377: error: expected primary-expression before '==' token
X_D_ThreadsFunctions:377: error: expected `;' before ')' token
Z_Loop:21: error: expected `}' at end of input
OK, I have taken you code and it compiles (after I have added dummy defines for all the global variables you use)
So the problem is probably that you have mismatched "{ }" or "( )" brackets somewhere else that confuses the compiler.
To find these place the cursor after a closing bracket and you should see a box around the matching beginning bracket. If it is not the one you expect it to be you have an error.
I figure the problem is somewhere within the simpleThread_isRun() Function I´m using. So I guess I have to do some more pocking around. However, good to know that my initial sample (expanded by the brackets jimmy suggested) is a go.
Is THREAD_LEDBlink a type or variable name? If so, whichever it is is missing its other half. If not & it's a macro, hard to debug without seeing the full thing.