WS2812B - Patterns
Materials
AmebaD [AMB21 / AMB22 / AMB23 / AMB25 / AMB26 / BW16 / AW-CU488 Thing Plus] x 1
WS2812B LED Strip / Ring / Stick / Board x1
Example
Introduction
In this example, we will be using the AmebaD board to control the WS2812B RGB LED, using the SPI peripheral to create the waveform necessary for the LEDs.
WS2812B basics allows you to control a single LED with a color or fill all the LED with the same color.
Procedure
Firstly, connect the WS2812B to the Ameba board as shown in the following diagrams.
AMB25 Wiring Diagram:
To create different light patterns with many different colors, use**WS2812B_Patterns**.
Open the example in “File” → “Example” → “AmebaWS2812B” → “WS2812B_Patterns”
In the sample code, modify TOTAL_NUM_OF_LEDS to be the total number of LEDs on the WS2812B module, and modify NUM_OF_LEDS to be the number of LEDs that you have connected.
Next compile and upload to Ameba, then press the reset button. You will see the WS2812B displaying a color wipe, theater chase, rainbow, and theater chase rainbow light patterns in loop.
Code Reference
[1] WS2812B Datasheet: