RGB LEDS of the neopixels
Dependencies: C12832_lcd PixelArray WS2812 mbed
Fork of WS2812_Example by
Revision 4:7a998a6934f1, committed 2015-04-16
- Comitter:
- cathal66
- Date:
- Thu Apr 16 09:23:20 2015 +0000
- Parent:
- 3:d429d33844c9
- Child:
- 5:60a9e2389a9c
- Commit message:
- fade smooth;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- 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);
}
}
--- a/mbed.bld Wed Apr 15 17:58:55 2015 +0000 +++ b/mbed.bld Thu Apr 16 09:23:20 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/433970e64889 \ No newline at end of file
