Use an output pin to control an LED.
Depending upon how the LED is configured then you may need to set the port high to turn it on, or you may need to set it low. Project Designer allows you to define the LED and then just use on or off commands to make it light up or not without having to worry, each time, as to how it is wired.
Users of Board Designer: call this LED 'statusLED' so that it automatically gets registered.
Users of Project Designer: if your board doesn't have a status LED and you want to add one then just make sure you call your LED 'statusLED'.
The Status LED
Many commercial boards include one or more 'built in' LEDs and one of these is used for flashing out runtime error code numbers to give you a visual clue as to what has gone wrong in your code. On some boards this LED is, unfortunately, connected to one of the UART pins. This is handy since it flashes to show communications are happening but unfortunately means you cannot see the flashing error code. Therefore the statusLED has some special handling so that it is only turned on/off whilst it is still set as an output pin.
In your code this special LED is called 'statusLed' ie:
The default is that the statusLed is turned on (as a power indicator) and whilst you may want to turn it off (in appInitSoftware for example) you are discouraged from playing with it too much otherwise you will interfere with the error code flashing !
- off - Turns off the LED.
- on - Turns on the LED.
- set - Turn the LED on or off.