Tiny-WS2812
1.0.0
A tiny cross-platform WS2812 LED Strip driver
|
Blinks one or more WS2812 devices using a more memory efficient method than the blink_array.c example. More...
Go to the source code of this file.
Macros | |
#define | N_LEDS 8 |
Number of LEDs on your WS2812 device(s) | |
#define | DATA_PINS {8, 9} |
Arduino pin(s) used to program the WS2812 device(s). Must share same port! (See https://www.arduino.cc/en/Reference/PortManipulation) | |
#define | RESET_TIME 50 |
Reset time in microseconds (50us recommended by datasheet) | |
#define | COLOR_ORDER grb |
Color order of your WS2812 LEDs (Typically grb or rgb) | |
Functions | |
void | setup () |
void | loop () |
Variables | |
uint8_t | pins [] = DATA_PINS |
Data pins. | |
ws2812 | ws2812_dev |
Device struct. | |
ws2812_rgb | white = {255,255,255} |
ws2812_rgb | black = {0, 0 ,0} |
Blinks one or more WS2812 devices using a more memory efficient method than the blink_array.c example.
The following example showcases how the Tiny-WS2812 library can be used on AVR platforms supporting the Arduino framework to blink an entire WS2812 device in white. Unlike the other blink example, we do not allocate a memory expensive array for every single LED here, but instead loop the transmission of a single RGB value until all WS2812 LEDs have been set.
The advantage of this method is that we can save allot of memory, the disadvantage is that this method is more prone to programming mistakes.
-DWS2812_TARGET_PLATFORM_ARDUINO_AVR
in the build flags, or by uncommenting the #define WS2812_TARGET_PLATFORM_ARDUINO_AVR
directive at the top of this file. Definition in file blink_loop.c.
void loop | ( | ) |
Continously blinks the entire WS2812 device in white.
Definition at line 82 of file blink_loop.c.
void setup | ( | ) |
Configures a WS2812 device struct.
Definition at line 63 of file blink_loop.c.