
A program that fades between a selection of colors.
Dependencies: PixelArray WS2812 mbed
Diff: main.cpp
- Revision:
- 3:b99f66d3e77e
- Parent:
- 2:381421ec57e1
--- a/main.cpp Sun Mar 12 22:23:08 2017 +0000 +++ b/main.cpp Sun Mar 12 23:04:00 2017 +0000 @@ -6,7 +6,6 @@ #define NUM_COLORS 6 //number of colors to store in the array #define NUM_STEPS 8 //number of steps between colors -DigitalIn usrBtn(USER_BUTTON); DigitalOut usrLed(LED1); PixelArray px(WS2812_BUF); @@ -48,16 +47,12 @@ std::size_t g1 = (c1 & 0x00ff00) >> 8; std::size_t b1 = (c1 & 0x0000ff); - printf("Starting colors (r,g,b): %d %d %d\n",r1,g1,b1); - //get ending RGB components for interpolation std::size_t c2 = colorbuf[colorTo]; std::size_t r2 = (c2 & 0xff0000) >> 16; std::size_t g2 = (c2 & 0x00ff00) >> 8; std::size_t b2 = (c2 & 0x0000ff); - printf("Ending colors (r,g,b): %d %d %d\n",r2,g2,b2); - for (int i = 0; i <= NUM_STEPS; i++) { ir = interpolate(r1, r2, i, NUM_STEPS);