Welcome to the DFRobot blog
:
www.dfrobot.com/blog-tag-microbit.html
57
/
86
Then, use the “show rainbow” function to setup light effect. This effect will only apply to LEDs that
we defined in our last step. The parameter inside the function block is used to set the gradient
range of color, 1 represents red whereas 360 represents blue, the closer these two numbers are, the
smaller the gradient changes:
The diagram will help you to have an overall understanding the meaning of each parameter: (try
to adjust the parameter and see how the light effect changes)
STEP 3: The pin P0 connected the strip comes with 7 LEDs. To add a rainbow light effect to the strip,
we will need to set the color range from 1-360 (red gradually changes to blue). Then, combine all
the function blocks and put them inside the “forever” loop, and our final program looks as
following:
Task 2: Turn on the rainbow lights