12. case 10 rainbow led ring¶
The RGB Rainbow LED Ring is made of 8 ws2818b pixels in a cascade connection. Its most notable characteristic is single IO control and infinite cascade. In this case, we will drive the RGB Rainbow LED with the micro:bit to make the rainbow colours rotate around the ring.
12.2. Hardware Connect¶
Connect circuit as above picture and put 2 AAA batteries into batteries pack.
12.3. Principles of Circuits¶
The GND of slot on micro:bit is into innards of batteries’ GND to generate the current loop.
12.4. Introduction of Components¶
RGB Rainbow LED Ring（8 LEDs）¶
The RGB Rainbow LED Ring is made of 8 ws2812b pixels in a cascade connection. Each ws2812b is made of an integrated control circuit and a RGB chip.
The first pixel receives 24bits of data through the DIN (Data IN) port, while the rest of the data is sent to the following pixels through the DOUT (Data OUT) port. With this automatic transformation forwarding technique, only the speed of data transmission is affected, not the quantity of data transmitted.
The experiment box included a set of RGB Rainbow LED（8 LEDs）.
- Note: Please note the positive and the negative when you are connecting.
Click on “New Project” and set a new Project.
Click Advanced for more code blocks and find the Extensions at the bottom of the column.
Search “neopixel” and add the neopixel.
Under the on start block, initialize the LED, set pin to P0 with 8 LEDs and use the RGB colour.
Then, set the rainbow from 1 to 360.
Now the colour of the LED has been set, but we need a show block to make it works.
Next, set rotate pixels to rotate the colour of the LED in a ring.
We can see a rainbow rotates on the LED ring.
How can we make the ring blink like an eye?