![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Initial (buggy) version
Dependencies: BLE_API mbed nRF51822
Fork of nRF51822_SimpleControls by
Diff: patterns.cpp
- Revision:
- 5:1f6311e0fc14
- Parent:
- 4:c8515fbd2e44
- Child:
- 6:074f5ec7428c
diff -r c8515fbd2e44 -r 1f6311e0fc14 patterns.cpp --- a/patterns.cpp Mon Nov 28 15:38:58 2016 +0000 +++ b/patterns.cpp Fri Dec 02 14:33:16 2016 +0000 @@ -102,4 +102,39 @@ neopixel_show(&m_strip); wait_ms(delay); } +} + +void xmas(int delay, uint8_t numLEDs, neopixel_strip_t m_strip) { + //All green + for (int j=0; j<numLEDs; j++) + neopixel_set_color(&m_strip, j, 0,255,0); + neopixel_show(&m_strip); + wait_ms(delay); + //All red + for (int j=0; j<numLEDs; j++) + neopixel_set_color(&m_strip, j, 255,0,0); + neopixel_show(&m_strip); + wait_ms(delay); + //Green with a red mover + for (int j=0; j<numLEDs; j++) + neopixel_set_color(&m_strip, j, 0,255,0); + neopixel_show(&m_strip); + wait_ms(delay); + for (int j=0; j<numLEDs; j++) + { + neopixel_set_color(&m_strip, j, 255,0,0); + neopixel_show(&m_strip); + wait_ms(delay); + } + //Red with a green mover + for (int j=0; j<numLEDs; j++) + neopixel_set_color(&m_strip, j, 255,0,0); + neopixel_show(&m_strip); + wait_ms(delay); + for (int j=0; j<numLEDs; j++) + { + neopixel_set_color(&m_strip, j, 0,255,0); + neopixel_show(&m_strip); + wait_ms(delay); + } } \ No newline at end of file