User Manual
21 22
1
2
3
4
Project 9 : Rainbow on The Desk
Diculty Level
Part List
Description
9. Rainbow on The Desk
There are 30 LEDs on the LED strip,
in this demo, you will learn to show
rainbow color on the Led strip and
use the Rotary Angle Sensor to let
the rainbow flow on the Led strip.
1x Grove - Rotary Angle Sensor(P)
1x Grove - WS2812b
1x Grove Shield for micro:bit
1x micro:bit
Steps
1. To use 'Grove - WS2812b LED strip', you need to
add the 'neopixel' package first.
2. Add basic block on start, then add variable block
set item to 0, rename ‘item’ to ‘Rainbow, replace ‘0’
with block Neopixel at pin (P1 ) with (30 ) leds as
RGB.
4. Connect the hardrware pieces as instructed.
5. Click Download to transfer your code in your
micro:bit!
6. Rotate the knob on the Grove – Rotary Angle Sensor and see if the rainbow flows.
Try to change the numbers of LEDs to show the rainbow, or use
the pin block map to have the rainbow ow more slowly.
3. Add basic block forever, then add pixel block
show rainbow from 1 to and pin block map, then
add variable block Rainbow and pin block analog
read pin P0, amend value in the blocks as below
2
2
3
3
3
2
1
P1/P15
4
P0/P14