- Wiring it up!
- Digital Colors
- Analogue Colors
- Blocks Code
- Python Code
- Challenge 1
RGB Color matching Game
Have a go at this RGB Color matching game.Color Matching Game
Introduction to RGB LEDs
An RGB LED is a special kind of led that contains three mini leds inside itself! 1 Red, 1 Green, 1 Blue.
Because it contains all three LEDs and each LED can be turned on/off off separately, you can combine colours to make different colours.
Also, because you can vary how bright each LED is, you can make any color whatsoever!
Digital Colors ( On or Off)
We can turn the individual lights on and off, and combining them means that we can create up to 8 colors!
|on||off||on||Magenta ( Purple)|
Take a look at the demo code to see for yourself!
Calculating Color valuesGoogle RGB Colors
Digital Vs Analogue Output
Turning the LEDs fully on or off will only get using a limited number of colors:
Red, Green, Blue, White, Black, Cyan,Magenta,Yellow
If we want to make ANY color, we need to use analogue value -this means that we need control the brightness of each LED. The Microbit allows you to set a brightness value of between 0 and 1023, but RGB colors only have individual channel values of between 0 and 255. So how do we fix this? We simply multiple the value by 4 and we have our Microbit analogue value!
Example – Baby Pink
Challenge 1 – Alernative LEDs
Get the RGB LED to alternate between red, green and blue LEDs
Challenge 2 – Traffic Light LEDs
Get the Microbit to emulate(copy) the functioning of a traffic light!
Challenge 3 – Orange / Purple alternator
Get the RGB Led to alternative between Orange and Purple
Challenge 4 – Rainbow RGB LED
Get the RGB LED to go through all the colours of the rainbow
Challenge 5 – Fade from White to off
Get the RGB LED to fade from fully on (white) to fully off
Challenge 5 – Fade from Green to Blue
Get the Microbit to fade from green to blue