Use of "or" / "||" with maestro 18 script

Hello I have a very newbie question. Im trying to close a door with an end switch and press obstacle switch. So I want to servo motor closes until endopen1 OR press1 switch is active, then stop motor. Actually it works ok with only one switch, but I do not understand how I can use || (or) operand before if statement.

I have trying:

   button_endopen1 || button_press1
   button_endopen1 button_press1 ||
   || button_endopen1 button_press1

but none of them appears to be the correct sintaxis.

Thanks a lot in advance.

sub close1
  begin
    button_endopen1 #  ***** or button_press1 here  ******
    if
      6000 1 servo
   	return
    else
      8000 1 servo
    endif
  repeat

Hello, Rodrigo.

The Maestro scripting command for that is LOGICAL_OR and it consumes two values off the top of the stack. (You can learn more about that command in the Command Reference section of the Maestro’s user’s guide, which you can find under the Resources tab of its product page.)

It sounds like you have two subroutines, button_endopen1 and button_press1 that return true (1) or false (0). If that is correct, you can pass arguments to that command like this:

button_endopen1 button_press1 LOGICAL_OR

If you are still not able to get things working, let me know and I would be happy to help.

-Jon

Thanks Jon! it works.

1 Like