Bi-colour LEDs contain two LEDs connected in ‘inverse parallel’. The two LEDs are often green and red. This means if current flows one way through the device the LED lights green, and if current flows the other way the LED lights red.
Flash a bi-colour LED
This program will cause a bi-colour LED to flash one colour and then the other. The LED should be connected with an inline resistor between output pin B.1 and output pin B.2.
- Code Example:
main: high B.1 ; Select one colour low B.2 pause 250 ; Keep the LED on for a short while low B.1 ; Turn the LED off (set both outputs low) pause 500 ; Keep the LED off for a while high B.2 ; Select the other colour low B.1 pause 250 ; Keep the LED on for a short while low B.2 ; Turn the LED off (set both outputs low) pause 500 ; Keep the LED off for a while goto main ; RepeatCopy Code Submit an Example
A bi-colour LED may be connected (with a 330R series resistor) to the two centre contacts of two generic terminal block create modules.
Bill of Materials
|Bi-colour red/green 5mm LED||LED006||1||Buy Now|
|330 ohm resistor (pack 100)||RES330R||1||Buy Now|
Submit Your Own Code!
You must be logged in to submit code examples. Login now.