Controlling a light

Similar to a button, one of the simplest output devices is a light that we can toggle on or off to signal something to the user. As mentioned above, industrial robots commonly use 24V and not the usual 5V or 3.3V found in microcontrollers, care must then be taken to power any device from the digital outputs. Off the shelf industrial signalling lights already include a resistor, meaning we can connect them directly like a push button, simply 2 wires going in the correct DO0, DO1, DO2.. for digital output 0, 1, 2.. and the corresponding Ground terminal, taking care to connect the light in the correct direction since it is polarised. Once connected, the corresponding command can be issued in a program to set the output state and turn on the light when desired.