Xtreme STEM
DashX

RoboBloX

RainbowBlock

RainbowBlock

 

Theory

Human eyes use 3 colour receptors (red, green, and blue).
We can thus fool our eyes into seeing any colour by combining various amounts of red, green, and blue light.
We call this RGB color.

The RainbowBlock is actually 3 LEDs in one.
By adjusting how bright each LED is, you can make:

256 x 256 x 256 = 16,777,216

Over 16 Million Colors!

RGB LED

 

 

Assembly

Connection Diagram

rb

 

mBlock

You can control how bright the LED is using PWM (Pulse Width Modulation),
but PWM only works on Pins 3, 5, 6, 9, 10, or 11
(We have chosen 9, 10 & 11 by default)

PWM is a number out of 255. Here are a few common values:

% 0% 6% 13% 20% 25% 39% 50% 59% 75% 100% %
PWM 0 16 32 50 64 100 128 150 192 255 PWM

 

HEX
R
G
B

 

You can use this color picker to pick any color (click the button),
then see if you can make your RainbowBlock the same color!

 

Hints

mBlock example

mBlock example

mBlock example

mBlock example

 

Example Programs

The sliders only work in full-screen mode.

rb

 

 

Scroll to Top