RGB LEDS of the neopixels
Dependencies: C12832_lcd PixelArray WS2812 mbed
Fork of WS2812_Example by
Diff: main.cpp
- Revision:
- 4:7a998a6934f1
- Parent:
- 3:d429d33844c9
- Child:
- 5:60a9e2389a9c
--- a/main.cpp Wed Apr 15 17:58:55 2015 +0000
+++ b/main.cpp Thu Apr 16 09:23:20 2015 +0000
@@ -17,7 +17,7 @@
ws.useII(WS2812::PER_PIXEL); // use per-pixel intensity scaling
// set up the colours we want to draw with
- int colorbuf[NUM_COLORS] = {0x000000};//,0x00f0ff,0x00ff00,0x00ffff,0xffffff,0x00ff00,0x00ffff,0x0000ff,0xff00ff};
+ int colorbuf[NUM_COLORS] = {0xfe0000};//,0x00f0ff,0x00ff00,0x00ffff,0xffffff,0x00ff00,0x00ffff,0x0000ff,0xff00ff};
@@ -42,21 +42,21 @@
while (1) {
if(colorbuf[0]>=0xfffffe)
{
- colorbuf[0]=0x000000;
+ //colorbuf[0]=0x000000;
}
- if(colorbuf[0]<=0x0000ff)
+ if(colorbuf[0]^0x000fff>=0x0001ff)
{
- colorbuf[0]=colorbuf[0]+0x00000f;
+ colorbuf[0]=colorbuf[0]+0x000001-0x010000;
//colorbuf[0] = 0x000000;
}
- else if(colorbuf[0]<=0x00ffff)
+ else if(colorbuf[0]^0x00ffff>=0x01ffff)
{
- colorbuf[0]=colorbuf[0]+0x000f00;
+ colorbuf[0]=colorbuf[0]+0x000100-0x000001;
}
else if(colorbuf[0]<=0xfffffe)
{
- colorbuf[0]=colorbuf[0]+0x0f0000;
+ colorbuf[0]=colorbuf[0]+0x010001-0x000100;
}
@@ -71,6 +71,6 @@
//wait(0.5);
}
- wait(0.1);
+ wait(0.01);
}
}
