A brief explanation for those playing along at home....
You'll see in my code lines like
LED1 = LEDOn
LED1 = LEDOff
S1 = Pressed
With microcontrollers, LEDs typically have the anode (positive end) connected to V+, and the cathode (negative end) connected to a port pin. When that pin is high (i.e., = 1), the LED is off, and when that pin is low (i.e., = 0) the LED is on. This is because microcontroller port pins are often better at sinking current (providing a ground connection) than sourcing current (providing V+).
That's how I usually do it, so I code say
LED1 = 1 to turn the LED off and
LED1 = 0 to turn the LED on.
But some boards I use are wired the the LED anodes connected to port pins and the cathode to ground, so the code is
LED1 = 1 would turn the LED on and
LED1 = 0 would turn the LED off.
When I look at the code in the future, I might see
LED1 = 1 and think the LED is off because that's how I usually do things, and wonder why nothing makes sense because this board is wired the other way round.
To make life simpler, and remove the ambiguity, LEDOn and LEDOff are constants, depending on how the board is arranged. It's a little more typing, but it makes understanding the code so much clearer.
The same logic goes for switches, with typically have a pull-up resistor to V+, and short the point pin to ground (i.e., 0) when pressed. But not always.
Seeing "when S1 = Pressed" tells you instantly what's going on when you scan the code.
Code:
If PORTB.0 = 0 then
PortB.7 = 1
Else
PortB.7 = 0
End If
//vs
If S1 = Pressed then
LED1 = LEDOn
Else
LED1 = LEDOff
End If
Each of those gives the exact same result. Which is easier to understand? How about six months from now when you want to change the code? I'm lazy, but a little extra typing now makes things so much easier when troubleshooting or trying to understand code in the future.