Alphabot2 for micro:bit User Manual
34 / 76
RAINBOW
We create a new project, coding four RGB LEDs for rainbow effect.
1. Place Set item to NeoPixel at pin P8 with 4 leds as (GRB format) block in on start
2. Create a variable hue, place set hue to 0
- these blocks can be created and founded in Variables package
3. Place change hue to 1 block in forever
4. Place item show rainbow from 1 to 360
- the range of hue is 1~360, different hue values stand for different colors, this
block will show average hue (1~360) to 4 RGB LEDs. More the RGB LEDs, more
colors are showed like rainbow.
5. Use 0 + 0 and hue block to complete the script
- 0 + 0 block can be found on Math package
6. Download the script to micro:bit and test