Code used in RGB-123 Kickstarter. Conways Game of Life

Dependencies:   WS2811_RY_A mbed

Fork of WS2811_RY_A by ohararp@...

Files at this revision

API Documentation at this revision

Comitter:
ohararp
Date:
Thu Aug 15 20:22:48 2013 +0000
Parent:
0:f19c80146d55
Commit message:
Code used in RGB-123 Kickstarter Video

Changed in this revision

WS2811_RY_32x48_ConwayA.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
matrix.h 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
diff -r f19c80146d55 -r 1b91ef74cc9c WS2811_RY_32x48_ConwayA.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WS2811_RY_32x48_ConwayA.lib	Thu Aug 15 20:22:48 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/ohararp/code/WS2811_RY_A/#f19c80146d55
diff -r f19c80146d55 -r 1b91ef74cc9c main.cpp
--- a/main.cpp	Fri Jan 04 13:43:52 2013 +0000
+++ b/main.cpp	Thu Aug 15 20:22:48 2013 +0000
@@ -1,20 +1,65 @@
 #include "mbed.h"
+#include "matrix.h"
 Serial pc(USBTX, USBRX);
 DigitalOut dat(p5);
-
+DigitalOut bLed(LED1);
 
 //*******************************************************************************    
 // DEFINE WS2811 Strip Parameters
-#define numLEDs 64*5
-uint8_t *pixels;
+#define numLEDs 1536 
+#define BrightMax 64
+#define BrightMin 0
+
+#define ROWS_LEDs 32  // LED_LAYOUT assumed 0 if ROWS_LEDs > 8
+#define COLS_LEDs 48  // all of the following params need to be adjusted for screen size
+
+
+uint8_t RandRed;
+uint8_t RandGrn;
+uint8_t RandBlu;
+
+uint8_t pixels[numLEDs*3];
 Timer guardtime;
 uint32_t bogocal;
+//*******************************************************************************
+//Byte val 2PI Cosine Wave, offset by 1 PI 
+//supports fast trig calcs and smooth LED fading/pulsing.
+uint8_t cos_wave[256] =  
+{0,0,0,0,1,1,1,2,2,3,4,5,6,6,8,9,10,11,12,14,15,17,18,20,22,23,25,27,29,31,33,35,38,40,42,
+45,47,49,52,54,57,60,62,65,68,71,73,76,79,82,85,88,91,94,97,100,103,106,109,113,116,119,
+122,125,128,131,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,
+189,191,194,197,199,202,204,207,209,212,214,216,218,221,223,225,227,229,231,232,234,236,
+238,239,241,242,243,245,246,247,248,249,250,251,252,252,253,253,254,254,255,255,255,255,
+255,255,255,255,254,254,253,253,252,252,251,250,249,248,247,246,245,243,242,241,239,238,
+236,234,232,231,229,227,225,223,221,218,216,214,212,209,207,204,202,199,197,194,191,189,
+186,183,180,177,174,171,168,165,162,159,156,153,150,147,144,141,138,135,131,128,125,122,
+119,116,113,109,106,103,100,97,94,91,88,85,82,79,76,73,71,68,65,62,60,57,54,52,49,47,45,
+42,40,38,35,33,31,29,27,25,23,22,20,18,17,15,14,12,11,10,9,8,6,6,5,4,3,2,2,1,1,1,0,0,0,0
+};
 
+
+//Gamma Correction Curve
+uint8_t exp_gamma[256] =
+{0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3,3,3,
+4,4,4,4,4,5,5,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,10,10,10,11,11,12,12,12,13,13,14,14,14,15,15,
+16,16,17,17,18,18,19,19,20,20,21,21,22,23,23,24,24,25,26,26,27,28,28,29,30,30,31,32,32,33,
+34,35,35,36,37,38,39,39,40,41,42,43,44,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,
+61,62,63,64,65,66,67,68,70,71,72,73,74,75,77,78,79,80,82,83,84,85,87,89,91,92,93,95,96,98,
+99,100,101,102,105,106,108,109,111,112,114,115,117,118,120,121,123,125,126,128,130,131,133,
+135,136,138,140,142,143,145,147,149,151,152,154,156,158,160,162,164,165,167,169,171,173,175,
+177,179,181,183,185,187,190,192,194,196,198,200,202,204,207,209,211,213,216,218,220,222,225,
+227,229,232,234,236,239,241,244,246,249,251,253,254,255
+};
 //*******************************************************************************
 void setup () {
-    if ((pixels = (uint8_t *)malloc(numLEDs * 3))) {
+    /*if ((pixels = (uint8_t *)malloc(numLEDs * 3))) {
         memset(pixels, 0x00, numLEDs * 3); // Init to RGB 'off' state
+    }*/
+    
+    for (int j=0; j<numLEDs*3; j++) {
+        pixels[j]=0x00;
     }
+    
     // calibrate delay loops for NRZ 
     int i;
     guardtime.start();
@@ -22,7 +67,8 @@
         /* do nothing */;
     i=guardtime.read_us();
     printf("ws2811:  1000 iters took %d usec.\n", i);
-    bogocal = (1000 / (i*4));//2.4)); // iterations per bitcell (417 nsec)
+    bogocal = (1000 / (i*10)); // iterations per bitcell (417 nsec)
+    bogocal = 1;
     printf("ws2811:  calibrating to %d bogojiffies.\n", bogocal);
 }
 //*******************************************************************************
@@ -74,12 +120,16 @@
 }
 //*******************************************************************************
 void blank(void) {
-    memset(pixels, 0x00, numLEDs * 3);
+    for (int i=0; i<numLEDs*3; i++) {
+        pixels[i]=0x00;
+    }
     show();
 }
 //*******************************************************************************
 void blankDelay(int n) {
-    memset(pixels, 0x00, numLEDs * 3);
+    for (int i=0; i<numLEDs*3; i++) {
+        pixels[i]=0x00;
+    }
     show();
     wait_ms(n);
 }
@@ -135,12 +185,41 @@
 // Fill the dots one after the other with a color
 void colorWipe(uint32_t c, uint8_t wait) {
   for(uint16_t i=0; i<numPixels(); i++) {
-      setPixelColor(i, c);
+      setPixelColor(Matrix[i], c);      
       show();
       wait_ms(wait);
   }
 }
 //*******************************************************************************
+// Fill the dots one after the other with a color
+void colorAll(uint32_t c, uint16_t wait) {
+  for(uint16_t i=0; i<numPixels(); i++) {
+      setPixelColor(Matrix[i], c);
+  }
+  show();
+  wait_ms(wait);
+}
+
+//*******************************************************************************
+// Fill the dots one after the other with a color
+void RandOne(uint8_t MaxRand, uint16_t wait) {
+  for(uint16_t i=0; i<numPixels(); i++) {
+        setPixelColor(Matrix[rand() % numLEDs-1], rand() % MaxRand,rand() % MaxRand,rand() % MaxRand);
+        show();
+        wait_ms(wait);
+  }
+
+}
+//*******************************************************************************
+// Fill the dots one after the other with a color
+void RandAll(uint8_t MaxRand, uint16_t wait) {
+  for(uint16_t i=0; i<numPixels(); i++) {
+        setPixelColor(Matrix[i], rand() % MaxRand,rand() % MaxRand,rand() % MaxRand);
+  }
+  show();
+  wait_ms(wait);
+}
+//*******************************************************************************
 // Input a value 0 to 255 to get a color value.
 // The colours are a transition r - g - b - back to r.
 uint32_t Wheel(int WheelPos) {
@@ -180,26 +259,349 @@
   }
 }
 //*******************************************************************************
+void Ring(int RingArray[], uint8_t r, uint8_t g, uint8_t b, uint8_t RingWait) {
+   
+    for (int i=1;i<RingArray[0];++i) {
+        setPixelColor(RingArray[i], r, g, b);
+        //pc.printf("RingArray[%d,%d]\n",RingArray[i],RingArray[0]);
+    }
+    show();
+    wait_ms(RingWait);
+}
+//*******************************************************************************
+void RingFadeUp(int RingArray[], uint8_t r, uint8_t g, uint8_t b, uint8_t FadeSteps, uint8_t FadeTime, uint16_t RingWait) {
+    uint8_t rBump, gBump, bBump;
+    uint8_t rStep, gStep, bStep;
+    
+    rStep = r/FadeSteps; if(rStep == 0) {rStep = 1;}
+    gStep = g/FadeSteps; if(gStep == 0) {gStep = 1;}
+    bStep = b/FadeSteps; if(bStep == 0) {bStep = 1;}
+        
+    rBump = 0;
+    gBump = 0;
+    bBump = 0;
+    
+    for (int j=0;j<FadeSteps;++j) {
+        rBump += rStep; if(rBump > BrightMax) {rBump = 0;} //Account for Int rollover
+        gBump += gStep; if(gBump > BrightMax) {gBump = 0;} //Account for Int rollover
+        bBump += bStep; if(bBump > BrightMax) {bBump = 0;} //Account for Int rollover
+        for (int i=1;i<RingArray[0];++i) {
+            setPixelColor(RingArray[i], rBump, gBump, bBump);
+            pc.printf("UP [%d,%d %d]\n",rBump, gBump, bBump);
+        }
+        show();
+    wait_ms(FadeTime);    
+    };
+    wait_ms(RingWait);
+}
+//*******************************************************************************
+void RingFadeDn(int RingArray[], uint8_t r, uint8_t g, uint8_t b, uint8_t FadeSteps, uint8_t FadeTime, uint16_t RingWait) {
+    uint8_t rBump, gBump, bBump;
+    uint8_t rStep, gStep, bStep;
+    
+    rStep = r/FadeSteps; if(rStep == 0) {rStep = 1;}
+    gStep = g/FadeSteps; if(gStep == 0) {gStep = 1;}
+    bStep = b/FadeSteps; if(bStep == 0) {bStep = 1;}
+    
+    rBump = r;
+    gBump = g;
+    bBump = b;
+    
+    for (int j=0;j<FadeSteps;++j) {
+        rBump -= rStep; if(rBump > BrightMax) {rBump = 0;} //Account for Int rollover
+        gBump -= gStep; if(gBump > BrightMax) {gBump = 0;} //Account for Int rollover
+        bBump -= bStep; if(bBump > BrightMax) {bBump = 0;} //Account for Int rollover
+        for (int i=1;i<RingArray[0];++i) {
+            setPixelColor(RingArray[i], rBump, gBump, bBump);
+            pc.printf("DN [%d,%d %d]\n",rBump, gBump, bBump);
+        }
+        show();
+    wait_ms(FadeTime);    
+    };
+    wait_ms(RingWait);
+}
+//*******************************************************************************
+uint8_t ColorRand(void) {
+    return (rand()%(BrightMax-BrightMin)+BrightMin);
+}
+//*******************************************************************************
+inline uint8_t fastCosineCalc( uint16_t preWrapVal)
+{
+  uint8_t wrapVal = (preWrapVal % 255);
+  if (wrapVal<=0){
+  wrapVal=255+wrapVal;
+  }
+  return cos_wave[wrapVal]; 
+}
+//*******************************************************************************
+void Plasma()
+{
+    unsigned long frameCount=25500;  // arbitrary seed to calculate the three time displacement variables t,t2,t3
+    while(1) {
+        frameCount++ ; //42 35 38
+        uint16_t t = fastCosineCalc((128 * frameCount)/100);  //time displacement - fiddle with these til it looks good...
+        uint16_t t2 = fastCosineCalc((128 * frameCount)/100); 
+        uint16_t t3 = fastCosineCalc((128 * frameCount)/100);
+        
+        for (uint8_t y = 0; y < ROWS_LEDs; y++) {
+          int left2Right, pixelIndex;
+          if (((y % (ROWS_LEDs/8)) & 1) == 0) {
+            left2Right = 1;
+            pixelIndex = y * COLS_LEDs;
+          } else {
+            left2Right = -1;
+            pixelIndex = (y + 1) * COLS_LEDs - 1;
+          }
+          for (uint8_t x = 0; x < COLS_LEDs ; x++) {
+            //Calculate 3 seperate plasma waves, one for each color channel
+            uint8_t r = fastCosineCalc(((x << 3) + (t >> 1) + fastCosineCalc((t2 + (y << 3)))));
+            uint8_t g = fastCosineCalc(((y << 3) + t + fastCosineCalc(((t3 >> 2) + (x << 3)))));
+            uint8_t b = fastCosineCalc(((y << 3) + t2 + fastCosineCalc((t + x + (g >> 2)))));
+            //uncomment the following to enable gamma correction
+            r=exp_gamma[r];  
+            g=exp_gamma[g];
+            b=exp_gamma[b];
+            setPixelColor(Matrix[pixelIndex],r,g,b);
+            //pc.printf("Plasma [%d,%d,%d %d]\n",pixelIndex,r,g,b);
+            pixelIndex += left2Right;
+          }
+        }
+        show();
+    }
+}
+
+//*******************************************************************************
+//http://onehourhacks.blogspot.com/2012/03/conways-game-of-life-on-arduino.html
+const int ROWS = 48;
+const int COLS = 32;
+int boardnum = 0; // number of boards run by the game
+int iteration = 0; // current round in the current board
+int numberAround(int row, int col);
+
+// The "Alive" cells on the board.
+uint32_t alive[ROWS] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+
+//*******************************************************************************
+bool isAlive(int row, int col)
+{
+return alive[row] & (1<<(col));
+}
+//*******************************************************************************
+void setAlive(int row, int col)
+{
+alive[row] |= 1 << col;
+}
+//*******************************************************************************
+/*
+ * Sets the alive array to all falses.
+ */
+void blank_alive()
+{
+for(int i = 0; i < ROWS; ++i)
+ alive[i] = 0;
+}
+//*******************************************************************************
+/**
+ * Writes output to the console.
+ */
+ 
+void do_output()
+{
+ //blank();
+ //pc.printf("Board: %d",boardnum);
+ //pc.printf(" Iteration: %d\n",iteration);
+    for(int i = 0; i < ROWS; i++)
+    {
+     for(int j = 0; j < COLS; j++)
+     {
+      // WIDTH, HEIGHT
+      if(isAlive(i,j))
+       {
+       setPixelColor(Matrix[i+RowIdx[j]],rand() % BrightMax,rand() % BrightMax,rand() % BrightMax);
+       //pc.printf("Alive: %d %d\n",i,j);
+       }
+      else
+       setPixelColor(Matrix[i+RowIdx[j]],0,0,0);
+     }
+    }
+}
+
+/**
+ * Randomly fills the grid with alive cells after blanking.
+ */
+void random_fill()
+{
+blank_alive();
+
+// Fill up 10-30% of the cells
+int numToFill = (ROWS * COLS) * (rand() % 30+10) / 100 ;
+
+for(int r = 0; r < numToFill; r ++)
+{
+ int row = rand() % ROWS;
+ int col = rand() % COLS;
+ 
+ setAlive(row,col);
+}
+}
+
+/**
+ * Returns the index of the row below the current one.
+ */
+int rowBelow(int row)
+{
+return (row + 1 < ROWS) ? row + 1 : 0;
+}
+
+/**
+ * Returns the index of the row above the given one
+ */
+int rowAbove(int row)
+{
+return (row > 0) ? row - 1 : ROWS - 1;
+}
+
+/** Returns the index of the col to the right of this one */
+int colRight(int col)
+{
+return (col + 1 < COLS) ? col + 1 : 0;
+}
+
+/** Returns the index of the col to the left of this one */
+int colLeft(int col)
+{
+return (col > 0) ? col - 1 : COLS -1;
+}
+
+/** true if the cell to the left is alive*/
+bool left(int row, int col)
+{
+col = colLeft(col);
+return isAlive(row,col);
+}
+
+/** true if the cell to the right is alive*/
+bool right(int row, int col)
+{
+col = colRight(col);
+return isAlive(row,col);
+}
+
+/** true if the cell above is alive*/
+bool above(int row, int col)
+{
+row = rowAbove(row);
+return isAlive(row,col);
+}
+
+/** true if the cell below is alive*/
+bool below(int row, int col)
+{
+row = rowBelow(row);
+return isAlive(row,col);
+}
+
+/** true if the cell NE is alive*/
+bool aboveright(int row, int col)
+{
+row = rowAbove(row);
+col = colRight(col);
+return isAlive(row,col);
+}
+
+/** true if the cell SE is alive*/
+bool belowright(int row, int col)
+{
+row = rowBelow(row);
+col = colRight(col);
+return isAlive(row,col);
+}
+
+/** true if the cell NW is alive*/
+bool aboveleft(int row, int col)
+{
+row = rowAbove(row);
+col = colLeft(col);
+return isAlive(row,col);
+}
+
+/** true if the cell SW is alive*/
+bool belowleft(int row, int col)
+{
+row = rowBelow(row);
+col = colLeft(col);
+return isAlive(row,col);
+}
+
+/**Returns the number of living cells sorrounding this one.*/
+int numberAround(int row, int col)
+{
+int around = 0;
+if(left(row,col))
+ around++;
+
+if(right(row,col))
+ around++;
+
+if(above(row,col))
+ around++;
+
+if(below(row,col))
+ around++;
+
+if(aboveright(row,col))
+ around++;
+
+if(aboveleft(row,col))
+ around++;
+
+if(belowright(row,col))
+ around++;
+
+if(belowleft(row,col))
+ around++;
+
+return around;
+}
+
+/**
+ * Moves all of the cells
+ */
+void move()
+{
+uint32_t nextRows[ROWS] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+
+for(int i = 0; i < ROWS; i++)
+{
+ for(int j = 0; j < COLS; j++)
+ {
+  int na = numberAround(i,j);
+  if((na == 2 && isAlive(i,j)) || na == 3)
+   nextRows[i] |= 1 << j;
+ }
+}
+for(int i = 0; i < ROWS; i++)
+ alive[i] = nextRows[i];
+}
+
+//*******************************************************************************
 int main() {
     pc.baud(38400);
     setup();
     while (1) {
         pc.printf("Top of the Loop\n");
-        colorWipe(Color(64, 0, 0), 50); // Red
-        blankDelay(250);
-        colorWipe(Color(0, 64, 0), 50); // Grn
-        blankDelay(250);
-        colorWipe(Color(0, 0, 64), 50); // Blu
-        blankDelay(250);
-        //rainbow(20);
-        //blankDelay(250);
-        //rainbowCycle(10);
-        //blankDelay(250);
+        bLed = !bLed;
+        blankDelay(0);
+  
+        boardnum++;
+        random_fill();
         
+        for(iteration = 0;iteration < 500; iteration++)
+        {
+         do_output();
+         show();
+         move(); 
+         wait_ms(0);
+        }
     }
-}
-
-//write(128);
-//wait_us(10);
-//write(0);
-//wait_us(10);
\ No newline at end of file
+}
\ No newline at end of file
diff -r f19c80146d55 -r 1b91ef74cc9c matrix.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/matrix.h	Thu Aug 15 20:22:48 2013 +0000
@@ -0,0 +1,109 @@
+int RowIdx[] = {
+  0,  48,  96, 144, 192, 240, 288, 336, 384, 432,480, 528, 576, 624, 672, 720,
+768, 816, 864, 912, 960, 1008, 1056, 1104, 1152, 1200,1248, 1296, 1344, 1392, 1440, 1488,
+1536
+};
+
+int Matrix[] = {
+  0,   1,   2,   3,   4,   5,   6,   7,   8,   9, 10,  11,  12,  13,  14,  15,
+256, 257, 258, 259, 260, 261, 262, 263, 264, 265,266, 267, 268, 269, 270, 271,
+512, 513, 514, 515, 516, 517, 518, 519, 520, 521,522, 523, 524, 525, 526, 527,
+ 31,  30,  29,  28,  27,  26,  25,  24,  23,  22, 21,  20,  19,  18,  17,  16,
+287, 286, 285, 284, 283, 282, 281, 280, 279, 278,277, 276, 275, 274, 273, 272,
+543, 542, 541, 540, 539, 538, 537, 536, 535, 534,533, 532, 531, 530, 529, 528,
+ 32,  33,  34,  35,  36,  37,  38,  39,  40,  41, 42,  43,  44,  45,  46,  47,
+288, 289, 290, 291, 292, 293, 294, 295, 296, 297,298, 299, 300, 301, 302, 303,
+544, 545, 546, 547, 548, 549, 550, 551, 552, 553,554, 555, 556, 557, 558, 559,
+ 63,  62,  61,  60,  59,  58,  57,  56,  55,  54, 53,  52,  51,  50,  49,  48,
+319, 318, 317, 316, 315, 314, 313, 312, 311, 310,309, 308, 307, 306, 305, 304,
+575, 574, 573, 572, 571, 570, 569, 568, 567, 566,565, 564, 563, 562, 561, 560,
+ 64,  65,  66,  67,  68,  69,  70,  71,  72,  73, 74,  75,  76,  77,  78,  79,
+320, 321, 322, 323, 324, 325, 326, 327, 328, 329,330, 331, 332, 333, 334, 335,
+576, 577, 578, 579, 580, 581, 582, 583, 584, 585,586, 587, 588, 589, 590, 591,
+ 95,  94,  93,  92,  91,  90,  89,  88,  87,  86, 85,  84,  83,  82,  81,  80,
+351, 350, 349, 348, 347, 346, 345, 344, 343, 342,341, 340, 339, 338, 337, 336,
+607, 606, 605, 604, 603, 602, 601, 600, 599, 598,597, 596, 595, 594, 593, 592,
+ 96,  97,  98,  99, 100, 101, 102, 103, 104, 105,106, 107, 108, 109, 110, 111,
+352, 353, 354, 355, 356, 357, 358, 359, 360, 361,362, 363, 364, 365, 366, 367,
+608, 609, 610, 611, 612, 613, 614, 615, 616, 617,618, 619, 620, 621, 622, 623,
+127, 126, 125, 124, 123, 122, 121, 120, 119, 118,117, 116, 115, 114, 113, 112,
+383, 382, 381, 380, 379, 378, 377, 376, 375, 374,373, 372, 371, 370, 369, 368,
+639, 638, 637, 636, 635, 634, 633, 632, 631, 630,629, 628, 627, 626, 625, 624,
+128, 129, 130, 131, 132, 133, 134, 135, 136, 137,138, 139, 140, 141, 142, 143,
+384, 385, 386, 387, 388, 389, 390, 391, 392, 393,394, 395, 396, 397, 398, 399,
+640, 641, 642, 643, 644, 645, 646, 647, 648, 649,650, 651, 652, 653, 654, 655,
+159, 158, 157, 156, 155, 154, 153, 152, 151, 150,149, 148, 147, 146, 145, 144,
+415, 414, 413, 412, 411, 410, 409, 408, 407, 406,405, 404, 403, 402, 401, 400,
+671, 670, 669, 668, 667, 666, 665, 664, 663, 662,661, 660, 659, 658, 657, 656,
+160, 161, 162, 163, 164, 165, 166, 167, 168, 169,170, 171, 172, 173, 174, 175,
+416, 417, 418, 419, 420, 421, 422, 423, 424, 425,426, 427, 428, 429, 430, 431,
+672, 673, 674, 675, 676, 677, 678, 679, 680, 681,682, 683, 684, 685, 686, 687,
+191, 190, 189, 188, 187, 186, 185, 184, 183, 182,181, 180, 179, 178, 177, 176,
+447, 446, 445, 444, 443, 442, 441, 440, 439, 438,437, 436, 435, 434, 433, 432,
+703, 702, 701, 700, 699, 698, 697, 696, 695, 694,693, 692, 691, 690, 689, 688,
+192, 193, 194, 195, 196, 197, 198, 199, 200, 201,202, 203, 204, 205, 206, 207,
+448, 449, 450, 451, 452, 453, 454, 455, 456, 457,458, 459, 460, 461, 462, 463,
+704, 705, 706, 707, 708, 709, 710, 711, 712, 713,714, 715, 716, 717, 718, 719,
+223, 222, 221, 220, 219, 218, 217, 216, 215, 214,213, 212, 211, 210, 209, 208,
+479, 478, 477, 476, 475, 474, 473, 472, 471, 470,469, 468, 467, 466, 465, 464,
+735, 734, 733, 732, 731, 730, 729, 728, 727, 726,725, 724, 723, 722, 721, 720,
+224, 225, 226, 227, 228, 229, 230, 231, 232, 233,234, 235, 236, 237, 238, 239,
+480, 481, 482, 483, 484, 485, 486, 487, 488, 489,490, 491, 492, 493, 494, 495,
+736, 737, 738, 739, 740, 741, 742, 743, 744, 745,746, 747, 748, 749, 750, 751,
+255, 254, 253, 252, 251, 250, 249, 248, 247, 246,245, 244, 243, 242, 241, 240,
+511, 510, 509, 508, 507, 506, 505, 504, 503, 502,501, 500, 499, 498, 497, 496,
+767, 766, 765, 764, 763, 762, 761, 760, 759, 758,757, 756, 755, 754, 753, 752,
+768, 769, 770, 771, 772, 773, 774, 775, 776, 777,778, 779, 780, 781, 782, 783,
+1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033,1034, 1035, 1036, 1037, 1038, 1039,
+1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289,1290, 1291, 1292, 1293, 1294, 1295,
+799, 798, 797, 796, 795, 794, 793, 792, 791, 790,789, 788, 787, 786, 785, 784,
+1055, 1054, 1053, 1052, 1051, 1050, 1049, 1048, 1047, 1046,1045, 1044, 1043, 1042, 1041, 1040,
+1311, 1310, 1309, 1308, 1307, 1306, 1305, 1304, 1303, 1302,1301, 1300, 1299, 1298, 1297, 1296,
+800, 801, 802, 803, 804, 805, 806, 807, 808, 809,810, 811, 812, 813, 814, 815,
+1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065,1066, 1067, 1068, 1069, 1070, 1071,
+1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321,1322, 1323, 1324, 1325, 1326, 1327,
+831, 830, 829, 828, 827, 826, 825, 824, 823, 822,821, 820, 819, 818, 817, 816,
+1087, 1086, 1085, 1084, 1083, 1082, 1081, 1080, 1079, 1078,1077, 1076, 1075, 1074, 1073, 1072,
+1343, 1342, 1341, 1340, 1339, 1338, 1337, 1336, 1335, 1334,1333, 1332, 1331, 1330, 1329, 1328,
+832, 833, 834, 835, 836, 837, 838, 839, 840, 841,842, 843, 844, 845, 846, 847,
+1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097,1098, 1099, 1100, 1101, 1102, 1103,
+1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353,1354, 1355, 1356, 1357, 1358, 1359,
+863, 862, 861, 860, 859, 858, 857, 856, 855, 854,853, 852, 851, 850, 849, 848,
+1119, 1118, 1117, 1116, 1115, 1114, 1113, 1112, 1111, 1110,1109, 1108, 1107, 1106, 1105, 1104,
+1375, 1374, 1373, 1372, 1371, 1370, 1369, 1368, 1367, 1366,1365, 1364, 1363, 1362, 1361, 1360,
+864, 865, 866, 867, 868, 869, 870, 871, 872, 873,874, 875, 876, 877, 878, 879,
+1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129,1130, 1131, 1132, 1133, 1134, 1135,
+1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385,1386, 1387, 1388, 1389, 1390, 1391,
+895, 894, 893, 892, 891, 890, 889, 888, 887, 886,885, 884, 883, 882, 881, 880,
+1151, 1150, 1149, 1148, 1147, 1146, 1145, 1144, 1143, 1142,1141, 1140, 1139, 1138, 1137, 1136,
+1407, 1406, 1405, 1404, 1403, 1402, 1401, 1400, 1399, 1398,1397, 1396, 1395, 1394, 1393, 1392,
+896, 897, 898, 899, 900, 901, 902, 903, 904, 905,906, 907, 908, 909, 910, 911,
+1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161,1162, 1163, 1164, 1165, 1166, 1167,
+1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417,1418, 1419, 1420, 1421, 1422, 1423,
+927, 926, 925, 924, 923, 922, 921, 920, 919, 918,917, 916, 915, 914, 913, 912,
+1183, 1182, 1181, 1180, 1179, 1178, 1177, 1176, 1175, 1174,1173, 1172, 1171, 1170, 1169, 1168,
+1439, 1438, 1437, 1436, 1435, 1434, 1433, 1432, 1431, 1430,1429, 1428, 1427, 1426, 1425, 1424,
+928, 929, 930, 931, 932, 933, 934, 935, 936, 937,938, 939, 940, 941, 942, 943,
+1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193,1194, 1195, 1196, 1197, 1198, 1199,
+1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449,1450, 1451, 1452, 1453, 1454, 1455,
+959, 958, 957, 956, 955, 954, 953, 952, 951, 950,949, 948, 947, 946, 945, 944,
+1215, 1214, 1213, 1212, 1211, 1210, 1209, 1208, 1207, 1206,1205, 1204, 1203, 1202, 1201, 1200,
+1471, 1470, 1469, 1468, 1467, 1466, 1465, 1464, 1463, 1462,1461, 1460, 1459, 1458, 1457, 1456,
+960, 961, 962, 963, 964, 965, 966, 967, 968, 969,970, 971, 972, 973, 974, 975,
+1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225,1226, 1227, 1228, 1229, 1230, 1231,
+1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481,1482, 1483, 1484, 1485, 1486, 1487,
+991, 990, 989, 988, 987, 986, 985, 984, 983, 982,981, 980, 979, 978, 977, 976,
+1247, 1246, 1245, 1244, 1243, 1242, 1241, 1240, 1239, 1238,1237, 1236, 1235, 1234, 1233, 1232,
+1503, 1502, 1501, 1500, 1499, 1498, 1497, 1496, 1495, 1494,1493, 1492, 1491, 1490, 1489, 1488,
+992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001,1002, 1003, 1004, 1005, 1006, 1007,
+1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257,1258, 1259, 1260, 1261, 1262, 1263,
+1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513,1514, 1515, 1516, 1517, 1518, 1519,
+1023, 1022, 1021, 1020, 1019, 1018, 1017, 1016, 1015, 1014,1013, 1012, 1011, 1010, 1009, 1008,
+1279, 1278, 1277, 1276, 1275, 1274, 1273, 1272, 1271, 1270,1269, 1268, 1267, 1266, 1265, 1264,
+1535, 1534, 1533, 1532, 1531, 1530, 1529, 1528, 1527, 1526,1525, 1524, 1523, 1522, 1521, 1520
+};
+
+int RandBright[] = {
+ 21,   5,   2,  15,  10,   6,  16,  13,
+  7,   4,  20,  18,  14,   0,  22,   1,
+  3,  17,  23,  12,   8,  19,   9,  11};
\ No newline at end of file
diff -r f19c80146d55 -r 1b91ef74cc9c mbed.bld
--- a/mbed.bld	Fri Jan 04 13:43:52 2013 +0000
+++ b/mbed.bld	Thu Aug 15 20:22:48 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/63cdd78b2dc1
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17
\ No newline at end of file