Color pixels library using WS2812B and nRF51822
Dependents: BLE_Color_Pixels Grove_Node BLE_HeartRate
Color pixels library using WS2812B and nRF51822 (16Hz)
It's for
- http://www.seeedstudio.com/depot/Digital-RGB-LED-FlexiStrip-60-LED-1-Meter-p-1666.html
- http://www.seeedstudio.com/depot/WS2812B-Digital-RGB-LED-Waterproof-FlexiStrip-144-LEDmeter-2-meter-p-1869.html
- http://www.seeedstudio.com/depot/WS2812B-RGB-LED-with-Integrated-Driver-Chip-10-PCs-pack-p-1675.html
Diff: color_pixels.cpp
- Revision:
- 3:91af7b451005
- Parent:
- 2:5c805323a2c0
- Child:
- 4:16ef874fa57f
--- a/color_pixels.cpp Tue Oct 28 11:03:20 2014 +0800 +++ b/color_pixels.cpp Thu Nov 06 02:19:42 2014 +0000 @@ -157,6 +157,17 @@ set_color(index, c.r, c.g, c.b); } +void ColorPixels::set_all_color(uint8_t r, uint8_t g, uint8_t b) +{ + for (int i = 0; i < num; i++) { + colors[i].r = r; + colors[i].g = g; + colors[i].b = b; + } + + update(); +} + void ColorPixels::update() { uint32_t mask = 1 << pin; @@ -274,3 +285,15 @@ update(); } + +void ColorPixels::rainbow(uint8_t r, uint8_t g, uint8_t b) +{ + color_t c; + + c.r = r; + c.g = g; + c.b = b; + + rainbow(c.rgb); +} +