First Imagine each indicator as a binary value with 0 being off and 1 being on.
Then imagine all 5 indicators in a row of binary digits.
So to represent from indicator 1 to 5 on, off, off, on, on you would have the number 11001 (read from right to left)
In binary each position (again, from right to left) represents a value. The first is 1, second 2, third 4, fourth 8 (see the powers of 2 progression) etc. With this system you can represent any number with the correct amount of digits. This particular switch supports 5 positions, if all are on , we would represent it as 11111. Converted to decimal, that’s 31.
You can use a binary converter to do this OR, you can calculate the values yourself. If we are talking about switch #1, we determine on or off, then multiply that result by the value that the position represents if it were set to 1. So for position 3 (indicator 3), you determine on or off, then multiply by 4.
What that means is you can represent any combination of ons and offs by doing the math, adding the numbers and sending THAT number to the switch with the IndicatorAllSet() method.
So in our original example: on, off, off, on, on is 11001. The math to convert is:
Indicator 1: on = 1, therefore: 1 * [value of position 1, which is 1] = 1
Indicator 2: off = 0, therefore: 0 * [value of position 2, which is 2] = 0
Indicator 3: off = 0, therefore: 0 * [value of position 3, which is 4] = 0
Indicator 4: on = 1, therefore: 1 * [value of position 4, which is 8] = 8
Indicator 5: on = 1, therefore: 1 * [value of position 5, which is 16] = 16
Add them all up = 1+8+16=25
Send IndicatorAllSet(25) to the controller and it will set that indicator pattern, because it does the binary conversion in the device handler and sets itself accordingly.
I’m using multiplication to determine my numbers, Scott is doing the same thing with addition. Either works.