In these expressions in Flowcode, a single "=" is equivalent to the double equals "==" when comparing values. You can use either, but I am a C/++ programmer and I personally prefer the double equals. The single equals in C/JavaScript/etc is used for assignment, but it is used for comparisons in languages like Basic and Pascal. Flowcode allows either.jgu1 wrote: ↑Sat Oct 11, 2025 9:19 amUNTIL(RemoteDown == 1 || Endestop_Down == 1)
UNTIL(RemoteDown = 1 OR Endestop_Down = 1)
WHILE(RemoteDown == 0 && Endestop_Down == 0)
UNTIL((RemoteDown == 0) && (Endestop_Down == 0))
And your suggest Martin (RemoteDown == 1) || (Endestop_Down == 1)none of them work
I sense that one of the variables is not being read in FC as soon as there are two variables, bugs?
For "not equals to" you can use "!=" or "<>".
"OR" is the bitwise operator and is equivalent to the single "|" operator in C. You want to use the logical operator "||" (or "&&" for logical AND).
I'd second the use of brackets. It makes it easier to see the intention of the code.
Another thing to consider when using bytes/ints as essentially boolean is to check that they are zero or not zero rather than a specific value. For example, if a byte value of "RemoteDown" was 2 (for some season) then "IF(RemoteDown == 1)" would be false, even though "IF (RemoteDown)" would be true. For this reason, it's often preferable to do something like "IF (RemoteDown != 0)" which is always true for any non-zero value of RemoteDown.
As for why it's not working in your code, if you are certain it's not a problem with your own code, then there are 2 things I can think it could be. Although both are very unlikely.
1. A compiler optimisation is causing a variable to be set to the wrong value.
2. A hardware fault that means the variable is not being set correctly.
For both of these, you could try putting some check in your code that the variables are actually being set to the values you expect at the appropriate time.
Another thing you could try is something like this:
Code: Select all
Set Abort = 0 (where About is a bool)
while (Abort == 0)
//check the first switch
if (RemoteDown is pressed)
Abort = 1
end if
//check the second switch
if (Endestop_Down is pressed)
Abort = 1
end if
end while loop