Script explained

In the code below
sub is the command to create a sub routine.
button is the name of the sub routine.
button becomes a command to do what is listed below it.
1 get_position 500 less_than.

(1 get_position) is looking at channel 1 for an input?
What does the (500 less_than) do? Is it looking for the value to drop
in the control center I see a value of 255.75 when the switch is open and 0 when its closed could that 500 be any # greater than 256 is this what the 500 is refering to?
(return) sets the script to look for the next button press?

#Returns 1 if the button is pressed, 0 otherwise. 
sub button
1 get_position 500 less_than 


Hello again Bobby.

Have you read the portion of the Maestro User’s Guide that explains scripts? It’s here:
In particular you should read everything in the “Maestro Script Language Basics” and the relevant portions of the “Command Reference” section. The “Command Reference” section describes every command in the Maestro language, including “get_position” and “less_than”.

The effect of that code is to place a number on the stack which is the “position” of channel 1. If you configured channel 1 as an input in the Channel Settings tab, the “position” corresponds to the voltage on the line.

“500” adds the number 500 to the top of the stack (so now in your case there are two numbers on the stack). “less_than” removes two numbers from the top of stack and replaces them with either a 0 or 1 depending on which number was greater. You should step through your script using the Maestro Control Center to see exactly how this works. You should also read the “Example Scripts” section of the manual from the beginning, and step through the first script on the page so you can see how a very simple script works.

The values displayed in the control center are divided by 4 before they are displayed on the screen. So “500” would be displayed as “125.00” in the control center, which is roughly 2.5 V.

“return” just returns to wherever the subroutine was called from. So the Maestro starts executing whatever code you wrote after the call to the “button” subroutine.

To me, it sounds weird that you used the word “looking” when describing these bits of code. Are you aware that the Maestro can only run one script command at a time, and these little bits of code take a few millisecond or less? After the code has executed, the Maestro will move on to do whatever is next, so it’s weird to use “looking” unless it’s the context of some loop or delay which lasts for a while (at least to me, maybe others disagree). I would have said “looks” instead.