Ivan Yohuno
/
neopixel_spi
Code to work with NeoPixels
Diff: main.cpp
- Revision:
- 2:35fd99de07b3
- Parent:
- 1:42b43fa7362f
- Child:
- 3:81ab43d7e3a2
--- a/main.cpp Thu Apr 23 17:04:03 2015 +0000 +++ b/main.cpp Thu Apr 23 17:52:28 2015 +0000 @@ -73,9 +73,7 @@ //function declarations void setRGBPixel(int r, int g, int b); //sets colour of one RGB Pixel void setRGBStrip(int r, int g, int b); //sets colour of a strip of 8 RGB Pixels -void setRGBStrips(int colours[4][3]); //sets colour of 4 strips of 8 RGB Pixels void setRGBPixels(int colours[8][3]); //sets sequence of colours for a strip of 8 RGB Pixels -//void setRGBAll(int colours[4][8][3]); //sets a sequence of colours for 4 strips of 8 RGB Pixels void setRGBFloor1(int colours[2][8][3]); //sets a sequence of colours for 2 strips of 8 RGB Pixels void setRGBFloor2(int colours[2][8][3]); //sets a sequence of colours for 2 strips of 8 RGB Pixels @@ -85,7 +83,7 @@ //initialize pins DigitalOut volt(p16); //pin for LV voltage -SPI spi1(p5, p6, p7);//pin for SPI communication - p5 MOSI p5 MISO p6 SCLK +SPI spi(p5, p6, p7);//pin for SPI communication - p5 MOSI p5 MISO p6 SCLK SPI spi2(p11, p12, p13);//pin for SPI communication - p5 MOSI p5 MISO p6 SCLK NeoStrip strip(p5,8); @@ -304,7 +302,6 @@ spi.write(b_array[0]); //set b0 bit //LED7 //set green bits - /* spi.write(g_array[7]); //set g7 bit spi.write(g_array[6]); //set g6 bit spi.write(g_array[5]); //set g5 bit @@ -331,7 +328,7 @@ spi.write(b_array[2]); //set b2 bit spi.write(b_array[1]); //set b1 bit spi.write(b_array[0]); //set b0 bit - */ + //wait for latch wait_us(60); } @@ -662,941 +659,7 @@ wait_us(60); } -void setRGBStrips(int colours[4][3]){ - //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary - int r0_array[8]; //room1 - int g0_array[8]; - int b0_array[8]; - memcpy(r0_array, decimalToBinary(colours[0][0]), sizeof(r0_array)); - memcpy(g0_array, decimalToBinary(colours[0][1]), sizeof(g0_array)); - memcpy(b0_array, decimalToBinary(colours[0][2]), sizeof(b0_array)); - int r1_array[8]; //room2 - int g1_array[8]; - int b1_array[8]; - memcpy(r1_array, decimalToBinary(colours[1][0]), sizeof(r1_array)); - memcpy(g1_array, decimalToBinary(colours[1][1]), sizeof(g1_array)); - memcpy(b1_array, decimalToBinary(colours[1][2]), sizeof(b1_array)); - int r2_array[8]; //room3 - int g2_array[8]; - int b2_array[8]; - memcpy(r2_array, decimalToBinary(colours[2][0]), sizeof(r2_array)); - memcpy(g2_array, decimalToBinary(colours[2][1]), sizeof(g2_array)); - memcpy(b2_array, decimalToBinary(colours[2][2]), sizeof(b2_array)); - int r3_array[8]; //room4 - int g3_array[8]; - int b3_array[8]; - memcpy(r3_array, decimalToBinary(colours[3][0]), sizeof(r3_array)); - memcpy(g3_array, decimalToBinary(colours[3][1]), sizeof(g3_array)); - memcpy(b3_array, decimalToBinary(colours[3][2]), sizeof(b3_array)); - - //send commands to LED Driver - //initialize SPI - spi_init(); - //room 1 - //LED0 - //set green bits - spi.write(g0_array[7]); //set g7 bit - spi.write(g0_array[6]); //set g6 bit - spi.write(g0_array[5]); //set g5 bit - spi.write(g0_array[4]); //set g4 bit - spi.write(g0_array[3]); //set g3 bit - spi.write(g0_array[2]); //set g2 bit - spi.write(g0_array[1]); //set g1 bit - spi.write(g0_array[0]);//set g0 bit - //set red bits - spi.write(r0_array[7]);//set r7 bit - spi.write(r0_array[6]); //set r6 bit - spi.write(r0_array[5]); //set r5 bit - spi.write(r0_array[4]); //set r4 bit - spi.write(r0_array[3]); //set r3 bit - spi.write(r0_array[2]); //set r2 bit - spi.write(r0_array[1]); //set r1 bit - spi.write(r0_array[0]); //set r0 bit - //set blue bits - spi.write(b0_array[7]); //set b7 bit - spi.write(b0_array[6]); //set b6 bit - spi.write(b0_array[5]); //set b5 bit - spi.write(b0_array[4]); //set b4 bit - spi.write(b0_array[3]); //set b3 bit - spi.write(b0_array[2]); //set b2 bit - spi.write(b0_array[1]); //set b1 bit - spi.write(b0_array[0]); //set b0 bit - //LED1 - //set green bits - spi.write(g0_array[7]); //set g7 bit - spi.write(g0_array[6]); //set g6 bit - spi.write(g0_array[5]); //set g5 bit - spi.write(g0_array[4]); //set g4 bit - spi.write(g0_array[3]); //set g3 bit - spi.write(g0_array[2]); //set g2 bit - spi.write(g0_array[1]); //set g1 bit - spi.write(g0_array[0]);//set g0 bit - //set red bits - spi.write(r0_array[7]);//set r7 bit - spi.write(r0_array[6]); //set r6 bit - spi.write(r0_array[5]); //set r5 bit - spi.write(r0_array[4]); //set r4 bit - spi.write(r0_array[3]); //set r3 bit - spi.write(r0_array[2]); //set r2 bit - spi.write(r0_array[1]); //set r1 bit - spi.write(r0_array[0]); //set r0 bit - //set blue bits - spi.write(b0_array[7]); //set b7 bit - spi.write(b0_array[6]); //set b6 bit - spi.write(b0_array[5]); //set b5 bit - spi.write(b0_array[4]); //set b4 bit - spi.write(b0_array[3]); //set b3 bit - spi.write(b0_array[2]); //set b2 bit - spi.write(b0_array[1]); //set b1 bit - spi.write(b0_array[0]); //set b0 bit - //LED2 - //set green bits - spi.write(g0_array[7]); //set g7 bit - spi.write(g0_array[6]); //set g6 bit - spi.write(g0_array[5]); //set g5 bit - spi.write(g0_array[4]); //set g4 bit - spi.write(g0_array[3]); //set g3 bit - spi.write(g0_array[2]); //set g2 bit - spi.write(g0_array[1]); //set g1 bit - spi.write(g0_array[0]);//set g0 bit - //set red bits - spi.write(r0_array[7]);//set r7 bit - spi.write(r0_array[6]); //set r6 bit - spi.write(r0_array[5]); //set r5 bit - spi.write(r0_array[4]); //set r4 bit - spi.write(r0_array[3]); //set r3 bit - spi.write(r0_array[2]); //set r2 bit - spi.write(r0_array[1]); //set r1 bit - spi.write(r0_array[0]); //set r0 bit - //set blue bits - spi.write(b0_array[7]); //set b7 bit - spi.write(b0_array[6]); //set b6 bit - spi.write(b0_array[5]); //set b5 bit - spi.write(b0_array[4]); //set b4 bit - spi.write(b0_array[3]); //set b3 bit - spi.write(b0_array[2]); //set b2 bit - spi.write(b0_array[1]); //set b1 bit - spi.write(b0_array[0]); //set b0 bit - //LED3 - //set green bits - spi.write(g0_array[7]); //set g7 bit - spi.write(g0_array[6]); //set g6 bit - spi.write(g0_array[5]); //set g5 bit - spi.write(g0_array[4]); //set g4 bit - spi.write(g0_array[3]); //set g3 bit - spi.write(g0_array[2]); //set g2 bit - spi.write(g0_array[1]); //set g1 bit - spi.write(g0_array[0]);//set g0 bit - //set red bits - spi.write(r0_array[7]);//set r7 bit - spi.write(r0_array[6]); //set r6 bit - spi.write(r0_array[5]); //set r5 bit - spi.write(r0_array[4]); //set r4 bit - spi.write(r0_array[3]); //set r3 bit - spi.write(r0_array[2]); //set r2 bit - spi.write(r0_array[1]); //set r1 bit - spi.write(r0_array[0]); //set r0 bit - //set blue bits - spi.write(b0_array[7]); //set b7 bit - spi.write(b0_array[6]); //set b6 bit - spi.write(b0_array[5]); //set b5 bit - spi.write(b0_array[4]); //set b4 bit - spi.write(b0_array[3]); //set b3 bit - spi.write(b0_array[2]); //set b2 bit - spi.write(b0_array[1]); //set b1 bit - spi.write(b0_array[0]); //set b0 bit - //LED4 - //set green bits - spi.write(g0_array[7]); //set g7 bit - spi.write(g0_array[6]); //set g6 bit - spi.write(g0_array[5]); //set g5 bit - spi.write(g0_array[4]); //set g4 bit - spi.write(g0_array[3]); //set g3 bit - spi.write(g0_array[2]); //set g2 bit - spi.write(g0_array[1]); //set g1 bit - spi.write(g0_array[0]);//set g0 bit - //set red bits - spi.write(r0_array[7]);//set r7 bit - spi.write(r0_array[6]); //set r6 bit - spi.write(r0_array[5]); //set r5 bit - spi.write(r0_array[4]); //set r4 bit - spi.write(r0_array[3]); //set r3 bit - spi.write(r0_array[2]); //set r2 bit - spi.write(r0_array[1]); //set r1 bit - spi.write(r0_array[0]); //set r0 bit - //set blue bits - spi.write(b0_array[7]); //set b7 bit - spi.write(b0_array[6]); //set b6 bit - spi.write(b0_array[5]); //set b5 bit - spi.write(b0_array[4]); //set b4 bit - spi.write(b0_array[3]); //set b3 bit - spi.write(b0_array[2]); //set b2 bit - spi.write(b0_array[1]); //set b1 bit - spi.write(b0_array[0]); //set b0 bit - //LED5 - //set green bits - spi.write(g0_array[7]); //set g7 bit - spi.write(g0_array[6]); //set g6 bit - spi.write(g0_array[5]); //set g5 bit - spi.write(g0_array[4]); //set g4 bit - spi.write(g0_array[3]); //set g3 bit - spi.write(g0_array[2]); //set g2 bit - spi.write(g0_array[1]); //set g1 bit - spi.write(g0_array[0]);//set g0 bit - //set red bits - spi.write(r0_array[7]);//set r7 bit - spi.write(r0_array[6]); //set r6 bit - spi.write(r0_array[5]); //set r5 bit - spi.write(r0_array[4]); //set r4 bit - spi.write(r0_array[3]); //set r3 bit - spi.write(r0_array[2]); //set r2 bit - spi.write(r0_array[1]); //set r1 bit - spi.write(r0_array[0]); //set r0 bit - //set blue bits - spi.write(b0_array[7]); //set b7 bit - spi.write(b0_array[6]); //set b6 bit - spi.write(b0_array[5]); //set b5 bit - spi.write(b0_array[4]); //set b4 bit - spi.write(b0_array[3]); //set b3 bit - spi.write(b0_array[2]); //set b2 bit - spi.write(b0_array[1]); //set b1 bit - spi.write(b0_array[0]); //set b0 bit - //LED6 - //set green bits - spi.write(g0_array[7]); //set g7 bit - spi.write(g0_array[6]); //set g6 bit - spi.write(g0_array[5]); //set g5 bit - spi.write(g0_array[4]); //set g4 bit - spi.write(g0_array[3]); //set g3 bit - spi.write(g0_array[2]); //set g2 bit - spi.write(g0_array[1]); //set g1 bit - spi.write(g0_array[0]);//set g0 bit - //set red bits - spi.write(r0_array[7]);//set r7 bit - spi.write(r0_array[6]); //set r6 bit - spi.write(r0_array[5]); //set r5 bit - spi.write(r0_array[4]); //set r4 bit - spi.write(r0_array[3]); //set r3 bit - spi.write(r0_array[2]); //set r2 bit - spi.write(r0_array[1]); //set r1 bit - spi.write(r0_array[0]); //set r0 bit - //set blue bits - spi.write(b0_array[7]); //set b7 bit - spi.write(b0_array[6]); //set b6 bit - spi.write(b0_array[5]); //set b5 bit - spi.write(b0_array[4]); //set b4 bit - spi.write(b0_array[3]); //set b3 bit - spi.write(b0_array[2]); //set b2 bit - spi.write(b0_array[1]); //set b1 bit - spi.write(b0_array[0]); //set b0 bit - //LED7 - //set green bits - spi.write(g0_array[7]); //set g7 bit - spi.write(g0_array[6]); //set g6 bit - spi.write(g0_array[5]); //set g5 bit - spi.write(g0_array[4]); //set g4 bit - spi.write(g0_array[3]); //set g3 bit - spi.write(g0_array[2]); //set g2 bit - spi.write(g0_array[1]); //set g1 bit - spi.write(g0_array[0]);//set g0 bit - //set red bits - spi.write(r0_array[7]);//set r7 bit - spi.write(r0_array[6]); //set r6 bit - spi.write(r0_array[5]); //set r5 bit - spi.write(r0_array[4]); //set r4 bit - spi.write(r0_array[3]); //set r3 bit - spi.write(r0_array[2]); //set r2 bit - spi.write(r0_array[1]); //set r1 bit - spi.write(r0_array[0]); //set r0 bit - //set blue bits - spi.write(b0_array[7]); //set b7 bit - spi.write(b0_array[6]); //set b6 bit - spi.write(b0_array[5]); //set b5 bit - spi.write(b0_array[4]); //set b4 bit - spi.write(b0_array[3]); //set b3 bit - spi.write(b0_array[2]); //set b2 bit - spi.write(b0_array[1]); //set b1 bit - spi.write(b0_array[0]); //set b0 bit - //room 2 - //LED0 - //set green bits - spi.write(g1_array[7]); //set g7 bit - spi.write(g1_array[6]); //set g6 bit - spi.write(g1_array[5]); //set g5 bit - spi.write(g1_array[4]); //set g4 bit - spi.write(g1_array[3]); //set g3 bit - spi.write(g1_array[2]); //set g2 bit - spi.write(g1_array[1]); //set g1 bit - spi.write(g1_array[0]);//set g0 bit - //set red bits - spi.write(r1_array[7]);//set r7 bit - spi.write(r1_array[6]); //set r6 bit - spi.write(r1_array[5]); //set r5 bit - spi.write(r1_array[4]); //set r4 bit - spi.write(r1_array[3]); //set r3 bit - spi.write(r1_array[2]); //set r2 bit - spi.write(r1_array[1]); //set r1 bit - spi.write(r1_array[0]); //set r0 bit - //set blue bits - spi.write(b1_array[7]); //set b7 bit - spi.write(b1_array[6]); //set b6 bit - spi.write(b1_array[5]); //set b5 bit - spi.write(b1_array[4]); //set b4 bit - spi.write(b1_array[3]); //set b3 bit - spi.write(b1_array[2]); //set b2 bit - spi.write(b1_array[1]); //set b1 bit - spi.write(b1_array[0]); //set b0 bit - //LED1 - //set green bits - spi.write(g1_array[7]); //set g7 bit - spi.write(g1_array[6]); //set g6 bit - spi.write(g1_array[5]); //set g5 bit - spi.write(g1_array[4]); //set g4 bit - spi.write(g1_array[3]); //set g3 bit - spi.write(g1_array[2]); //set g2 bit - spi.write(g1_array[1]); //set g1 bit - spi.write(g1_array[0]);//set g0 bit - //set red bits - spi.write(r1_array[7]);//set r7 bit - spi.write(r1_array[6]); //set r6 bit - spi.write(r1_array[5]); //set r5 bit - spi.write(r1_array[4]); //set r4 bit - spi.write(r1_array[3]); //set r3 bit - spi.write(r1_array[2]); //set r2 bit - spi.write(r1_array[1]); //set r1 bit - spi.write(r1_array[0]); //set r0 bit - //set blue bits - spi.write(b1_array[7]); //set b7 bit - spi.write(b1_array[6]); //set b6 bit - spi.write(b1_array[5]); //set b5 bit - spi.write(b1_array[4]); //set b4 bit - spi.write(b1_array[3]); //set b3 bit - spi.write(b1_array[2]); //set b2 bit - spi.write(b1_array[1]); //set b1 bit - spi.write(b1_array[0]); //set b0 bit - //LED2 - //set green bits - spi.write(g1_array[7]); //set g7 bit - spi.write(g1_array[6]); //set g6 bit - spi.write(g1_array[5]); //set g5 bit - spi.write(g1_array[4]); //set g4 bit - spi.write(g1_array[3]); //set g3 bit - spi.write(g1_array[2]); //set g2 bit - spi.write(g1_array[1]); //set g1 bit - spi.write(g1_array[0]);//set g0 bit - //set red bits - spi.write(r1_array[7]);//set r7 bit - spi.write(r1_array[6]); //set r6 bit - spi.write(r1_array[5]); //set r5 bit - spi.write(r1_array[4]); //set r4 bit - spi.write(r1_array[3]); //set r3 bit - spi.write(r1_array[2]); //set r2 bit - spi.write(r1_array[1]); //set r1 bit - spi.write(r1_array[0]); //set r0 bit - //set blue bits - spi.write(b1_array[7]); //set b7 bit - spi.write(b1_array[6]); //set b6 bit - spi.write(b1_array[5]); //set b5 bit - spi.write(b1_array[4]); //set b4 bit - spi.write(b1_array[3]); //set b3 bit - spi.write(b1_array[2]); //set b2 bit - spi.write(b1_array[1]); //set b1 bit - spi.write(b1_array[0]); //set b0 bit - //LED3 - //set green bits - spi.write(g1_array[7]); //set g7 bit - spi.write(g1_array[6]); //set g6 bit - spi.write(g1_array[5]); //set g5 bit - spi.write(g1_array[4]); //set g4 bit - spi.write(g1_array[3]); //set g3 bit - spi.write(g1_array[2]); //set g2 bit - spi.write(g1_array[1]); //set g1 bit - spi.write(g1_array[0]);//set g0 bit - //set red bits - spi.write(r1_array[7]);//set r7 bit - spi.write(r1_array[6]); //set r6 bit - spi.write(r1_array[5]); //set r5 bit - spi.write(r1_array[4]); //set r4 bit - spi.write(r1_array[3]); //set r3 bit - spi.write(r1_array[2]); //set r2 bit - spi.write(r1_array[1]); //set r1 bit - spi.write(r1_array[0]); //set r0 bit - //set blue bits - spi.write(b1_array[7]); //set b7 bit - spi.write(b1_array[6]); //set b6 bit - spi.write(b1_array[5]); //set b5 bit - spi.write(b1_array[4]); //set b4 bit - spi.write(b1_array[3]); //set b3 bit - spi.write(b1_array[2]); //set b2 bit - spi.write(b1_array[1]); //set b1 bit - spi.write(b1_array[0]); //set b0 bit - //LED4 - //set green bits - spi.write(g1_array[7]); //set g7 bit - spi.write(g1_array[6]); //set g6 bit - spi.write(g1_array[5]); //set g5 bit - spi.write(g1_array[4]); //set g4 bit - spi.write(g1_array[3]); //set g3 bit - spi.write(g1_array[2]); //set g2 bit - spi.write(g1_array[1]); //set g1 bit - spi.write(g1_array[0]);//set g0 bit - //set red bits - spi.write(r1_array[7]);//set r7 bit - spi.write(r1_array[6]); //set r6 bit - spi.write(r1_array[5]); //set r5 bit - spi.write(r1_array[4]); //set r4 bit - spi.write(r1_array[3]); //set r3 bit - spi.write(r1_array[2]); //set r2 bit - spi.write(r1_array[1]); //set r1 bit - spi.write(r1_array[0]); //set r0 bit - //set blue bits - spi.write(b1_array[7]); //set b7 bit - spi.write(b1_array[6]); //set b6 bit - spi.write(b1_array[5]); //set b5 bit - spi.write(b1_array[4]); //set b4 bit - spi.write(b1_array[3]); //set b3 bit - spi.write(b1_array[2]); //set b2 bit - spi.write(b1_array[1]); //set b1 bit - spi.write(b1_array[0]); //set b0 bit - //LED5 - //set green bits - spi.write(g1_array[7]); //set g7 bit - spi.write(g1_array[6]); //set g6 bit - spi.write(g1_array[5]); //set g5 bit - spi.write(g1_array[4]); //set g4 bit - spi.write(g1_array[3]); //set g3 bit - spi.write(g1_array[2]); //set g2 bit - spi.write(g1_array[1]); //set g1 bit - spi.write(g1_array[0]);//set g0 bit - //set red bits - spi.write(r1_array[7]);//set r7 bit - spi.write(r1_array[6]); //set r6 bit - spi.write(r1_array[5]); //set r5 bit - spi.write(r1_array[4]); //set r4 bit - spi.write(r1_array[3]); //set r3 bit - spi.write(r1_array[2]); //set r2 bit - spi.write(r1_array[1]); //set r1 bit - spi.write(r1_array[0]); //set r0 bit - //set blue bits - spi.write(b1_array[7]); //set b7 bit - spi.write(b1_array[6]); //set b6 bit - spi.write(b1_array[5]); //set b5 bit - spi.write(b1_array[4]); //set b4 bit - spi.write(b1_array[3]); //set b3 bit - spi.write(b1_array[2]); //set b2 bit - spi.write(b1_array[1]); //set b1 bit - spi.write(b1_array[0]); //set b0 bit - //LED6 - //set green bits - spi.write(g1_array[7]); //set g7 bit - spi.write(g1_array[6]); //set g6 bit - spi.write(g1_array[5]); //set g5 bit - spi.write(g1_array[4]); //set g4 bit - spi.write(g1_array[3]); //set g3 bit - spi.write(g1_array[2]); //set g2 bit - spi.write(g1_array[1]); //set g1 bit - spi.write(g1_array[0]);//set g0 bit - //set red bits - spi.write(r1_array[7]);//set r7 bit - spi.write(r1_array[6]); //set r6 bit - spi.write(r1_array[5]); //set r5 bit - spi.write(r1_array[4]); //set r4 bit - spi.write(r1_array[3]); //set r3 bit - spi.write(r1_array[2]); //set r2 bit - spi.write(r1_array[1]); //set r1 bit - spi.write(r1_array[0]); //set r0 bit - //set blue bits - spi.write(b1_array[7]); //set b7 bit - spi.write(b1_array[6]); //set b6 bit - spi.write(b1_array[5]); //set b5 bit - spi.write(b1_array[4]); //set b4 bit - spi.write(b1_array[3]); //set b3 bit - spi.write(b1_array[2]); //set b2 bit - spi.write(b1_array[1]); //set b1 bit - spi.write(b1_array[0]); //set b0 bit - //LED7 - //set green bits - spi.write(g1_array[7]); //set g7 bit - spi.write(g1_array[6]); //set g6 bit - spi.write(g1_array[5]); //set g5 bit - spi.write(g1_array[4]); //set g4 bit - spi.write(g1_array[3]); //set g3 bit - spi.write(g1_array[2]); //set g2 bit - spi.write(g1_array[1]); //set g1 bit - spi.write(g1_array[0]);//set g0 bit - //set red bits - spi.write(r1_array[7]);//set r7 bit - spi.write(r1_array[6]); //set r6 bit - spi.write(r1_array[5]); //set r5 bit - spi.write(r1_array[4]); //set r4 bit - spi.write(r1_array[3]); //set r3 bit - spi.write(r1_array[2]); //set r2 bit - spi.write(r1_array[1]); //set r1 bit - spi.write(r1_array[0]); //set r0 bit - //set blue bits - spi.write(b1_array[7]); //set b7 bit - spi.write(b1_array[6]); //set b6 bit - spi.write(b1_array[5]); //set b5 bit - spi.write(b1_array[4]); //set b4 bit - spi.write(b1_array[3]); //set b3 bit - spi.write(b1_array[2]); //set b2 bit - spi.write(b1_array[1]); //set b1 bit - spi.write(b1_array[0]); //set b0 bit - //room3 - //LED0 - //set green bits - spi.write(g2_array[7]); //set g7 bit - spi.write(g2_array[6]); //set g6 bit - spi.write(g2_array[5]); //set g5 bit - spi.write(g2_array[4]); //set g4 bit - spi.write(g2_array[3]); //set g3 bit - spi.write(g2_array[2]); //set g2 bit - spi.write(g2_array[1]); //set g1 bit - spi.write(g2_array[0]);//set g0 bit - //set red bits - spi.write(r2_array[7]);//set r7 bit - spi.write(r2_array[6]); //set r6 bit - spi.write(r2_array[5]); //set r5 bit - spi.write(r2_array[4]); //set r4 bit - spi.write(r2_array[3]); //set r3 bit - spi.write(r2_array[2]); //set r2 bit - spi.write(r2_array[1]); //set r1 bit - spi.write(r2_array[0]); //set r0 bit - //set blue bits - spi.write(b2_array[7]); //set b7 bit - spi.write(b2_array[6]); //set b6 bit - spi.write(b2_array[5]); //set b5 bit - spi.write(b2_array[4]); //set b4 bit - spi.write(b2_array[3]); //set b3 bit - spi.write(b2_array[2]); //set b2 bit - spi.write(b2_array[1]); //set b1 bit - spi.write(b2_array[0]); //set b0 bit - //LED1 - //set green bits - spi.write(g2_array[7]); //set g7 bit - spi.write(g2_array[6]); //set g6 bit - spi.write(g2_array[5]); //set g5 bit - spi.write(g2_array[4]); //set g4 bit - spi.write(g2_array[3]); //set g3 bit - spi.write(g2_array[2]); //set g2 bit - spi.write(g2_array[1]); //set g1 bit - spi.write(g2_array[0]);//set g0 bit - //set red bits - spi.write(r2_array[7]);//set r7 bit - spi.write(r2_array[6]); //set r6 bit - spi.write(r2_array[5]); //set r5 bit - spi.write(r2_array[4]); //set r4 bit - spi.write(r2_array[3]); //set r3 bit - spi.write(r2_array[2]); //set r2 bit - spi.write(r2_array[1]); //set r1 bit - spi.write(r2_array[0]); //set r0 bit - //set blue bits - spi.write(b2_array[7]); //set b7 bit - spi.write(b2_array[6]); //set b6 bit - spi.write(b2_array[5]); //set b5 bit - spi.write(b2_array[4]); //set b4 bit - spi.write(b2_array[3]); //set b3 bit - spi.write(b2_array[2]); //set b2 bit - spi.write(b2_array[1]); //set b1 bit - spi.write(b2_array[0]); //set b0 bit - //LED2 - //set green bits - spi.write(g2_array[7]); //set g7 bit - spi.write(g2_array[6]); //set g6 bit - spi.write(g2_array[5]); //set g5 bit - spi.write(g2_array[4]); //set g4 bit - spi.write(g2_array[3]); //set g3 bit - spi.write(g2_array[2]); //set g2 bit - spi.write(g2_array[1]); //set g1 bit - spi.write(g2_array[0]);//set g0 bit - //set red bits - spi.write(r2_array[7]);//set r7 bit - spi.write(r2_array[6]); //set r6 bit - spi.write(r2_array[5]); //set r5 bit - spi.write(r2_array[4]); //set r4 bit - spi.write(r2_array[3]); //set r3 bit - spi.write(r2_array[2]); //set r2 bit - spi.write(r2_array[1]); //set r1 bit - spi.write(r2_array[0]); //set r0 bit - //set blue bits - spi.write(b2_array[7]); //set b7 bit - spi.write(b2_array[6]); //set b6 bit - spi.write(b2_array[5]); //set b5 bit - spi.write(b2_array[4]); //set b4 bit - spi.write(b2_array[3]); //set b3 bit - spi.write(b2_array[2]); //set b2 bit - spi.write(b2_array[1]); //set b1 bit - spi.write(b2_array[0]); //set b0 bit - //LED3 - //set green bits - spi.write(g2_array[7]); //set g7 bit - spi.write(g2_array[6]); //set g6 bit - spi.write(g2_array[5]); //set g5 bit - spi.write(g2_array[4]); //set g4 bit - spi.write(g2_array[3]); //set g3 bit - spi.write(g2_array[2]); //set g2 bit - spi.write(g2_array[1]); //set g1 bit - spi.write(g2_array[0]);//set g0 bit - //set red bits - spi.write(r2_array[7]);//set r7 bit - spi.write(r2_array[6]); //set r6 bit - spi.write(r2_array[5]); //set r5 bit - spi.write(r2_array[4]); //set r4 bit - spi.write(r2_array[3]); //set r3 bit - spi.write(r2_array[2]); //set r2 bit - spi.write(r2_array[1]); //set r1 bit - spi.write(r2_array[0]); //set r0 bit - //set blue bits - spi.write(b2_array[7]); //set b7 bit - spi.write(b2_array[6]); //set b6 bit - spi.write(b2_array[5]); //set b5 bit - spi.write(b2_array[4]); //set b4 bit - spi.write(b2_array[3]); //set b3 bit - spi.write(b2_array[2]); //set b2 bit - spi.write(b2_array[1]); //set b1 bit - spi.write(b2_array[0]); //set b0 bit - //LED4 - //set green bits - spi.write(g2_array[7]); //set g7 bit - spi.write(g2_array[6]); //set g6 bit - spi.write(g2_array[5]); //set g5 bit - spi.write(g2_array[4]); //set g4 bit - spi.write(g2_array[3]); //set g3 bit - spi.write(g2_array[2]); //set g2 bit - spi.write(g2_array[1]); //set g1 bit - spi.write(g2_array[0]);//set g0 bit - //set red bits - spi.write(r2_array[7]);//set r7 bit - spi.write(r2_array[6]); //set r6 bit - spi.write(r2_array[5]); //set r5 bit - spi.write(r2_array[4]); //set r4 bit - spi.write(r2_array[3]); //set r3 bit - spi.write(r2_array[2]); //set r2 bit - spi.write(r2_array[1]); //set r1 bit - spi.write(r2_array[0]); //set r0 bit - //set blue bits - spi.write(b2_array[7]); //set b7 bit - spi.write(b2_array[6]); //set b6 bit - spi.write(b2_array[5]); //set b5 bit - spi.write(b2_array[4]); //set b4 bit - spi.write(b2_array[3]); //set b3 bit - spi.write(b2_array[2]); //set b2 bit - spi.write(b2_array[1]); //set b1 bit - spi.write(b2_array[0]); //set b0 bit - //LED5 - //set green bits - spi.write(g2_array[7]); //set g7 bit - spi.write(g2_array[6]); //set g6 bit - spi.write(g2_array[5]); //set g5 bit - spi.write(g2_array[4]); //set g4 bit - spi.write(g2_array[3]); //set g3 bit - spi.write(g2_array[2]); //set g2 bit - spi.write(g2_array[1]); //set g1 bit - spi.write(g2_array[0]);//set g0 bit - //set red bits - spi.write(r2_array[7]);//set r7 bit - spi.write(r2_array[6]); //set r6 bit - spi.write(r2_array[5]); //set r5 bit - spi.write(r2_array[4]); //set r4 bit - spi.write(r2_array[3]); //set r3 bit - spi.write(r2_array[2]); //set r2 bit - spi.write(r2_array[1]); //set r1 bit - spi.write(r2_array[0]); //set r0 bit - //set blue bits - spi.write(b2_array[7]); //set b7 bit - spi.write(b2_array[6]); //set b6 bit - spi.write(b2_array[5]); //set b5 bit - spi.write(b2_array[4]); //set b4 bit - spi.write(b2_array[3]); //set b3 bit - spi.write(b2_array[2]); //set b2 bit - spi.write(b2_array[1]); //set b1 bit - spi.write(b2_array[0]); //set b0 bit - //LED6 - //set green bits - spi.write(g2_array[7]); //set g7 bit - spi.write(g2_array[6]); //set g6 bit - spi.write(g2_array[5]); //set g5 bit - spi.write(g2_array[4]); //set g4 bit - spi.write(g2_array[3]); //set g3 bit - spi.write(g2_array[2]); //set g2 bit - spi.write(g2_array[1]); //set g1 bit - spi.write(g2_array[0]);//set g0 bit - //set red bits - spi.write(r2_array[7]);//set r7 bit - spi.write(r2_array[6]); //set r6 bit - spi.write(r2_array[5]); //set r5 bit - spi.write(r2_array[4]); //set r4 bit - spi.write(r2_array[3]); //set r3 bit - spi.write(r2_array[2]); //set r2 bit - spi.write(r2_array[1]); //set r1 bit - spi.write(r2_array[0]); //set r0 bit - //set blue bits - spi.write(b2_array[7]); //set b7 bit - spi.write(b2_array[6]); //set b6 bit - spi.write(b2_array[5]); //set b5 bit - spi.write(b2_array[4]); //set b4 bit - spi.write(b2_array[3]); //set b3 bit - spi.write(b2_array[2]); //set b2 bit - spi.write(b2_array[1]); //set b1 bit - spi.write(b2_array[0]); //set b0 bit - //LED7 - //set green bits - spi.write(g2_array[7]); //set g7 bit - spi.write(g2_array[6]); //set g6 bit - spi.write(g2_array[5]); //set g5 bit - spi.write(g2_array[4]); //set g4 bit - spi.write(g2_array[3]); //set g3 bit - spi.write(g2_array[2]); //set g2 bit - spi.write(g2_array[1]); //set g1 bit - spi.write(g2_array[0]);//set g0 bit - //set red bits - spi.write(r2_array[7]);//set r7 bit - spi.write(r2_array[6]); //set r6 bit - spi.write(r2_array[5]); //set r5 bit - spi.write(r2_array[4]); //set r4 bit - spi.write(r2_array[3]); //set r3 bit - spi.write(r2_array[2]); //set r2 bit - spi.write(r2_array[1]); //set r1 bit - spi.write(r2_array[0]); //set r0 bit - //set blue bits - spi.write(b2_array[7]); //set b7 bit - spi.write(b2_array[6]); //set b6 bit - spi.write(b2_array[5]); //set b5 bit - spi.write(b2_array[4]); //set b4 bit - spi.write(b2_array[3]); //set b3 bit - spi.write(b2_array[2]); //set b2 bit - spi.write(b2_array[1]); //set b1 bit - spi.write(b2_array[0]); //set b0 bit - //room 4 - //LED0 - //set green bits - spi.write(g3_array[7]); //set g7 bit - spi.write(g3_array[6]); //set g6 bit - spi.write(g3_array[5]); //set g5 bit - spi.write(g3_array[4]); //set g4 bit - spi.write(g3_array[3]); //set g3 bit - spi.write(g3_array[2]); //set g2 bit - spi.write(g3_array[1]); //set g1 bit - spi.write(g3_array[0]);//set g0 bit - //set red bits - spi.write(r3_array[7]);//set r7 bit - spi.write(r3_array[6]); //set r6 bit - spi.write(r3_array[5]); //set r5 bit - spi.write(r3_array[4]); //set r4 bit - spi.write(r3_array[3]); //set r3 bit - spi.write(r3_array[2]); //set r2 bit - spi.write(r3_array[1]); //set r1 bit - spi.write(r3_array[0]); //set r0 bit - //set blue bits - spi.write(b3_array[7]); //set b7 bit - spi.write(b3_array[6]); //set b6 bit - spi.write(b3_array[5]); //set b5 bit - spi.write(b3_array[4]); //set b4 bit - spi.write(b3_array[3]); //set b3 bit - spi.write(b3_array[2]); //set b2 bit - spi.write(b3_array[1]); //set b1 bit - spi.write(b3_array[0]); //set b0 bit - //LED1 - //set green bits - spi.write(g3_array[7]); //set g7 bit - spi.write(g3_array[6]); //set g6 bit - spi.write(g3_array[5]); //set g5 bit - spi.write(g3_array[4]); //set g4 bit - spi.write(g3_array[3]); //set g3 bit - spi.write(g3_array[2]); //set g2 bit - spi.write(g3_array[1]); //set g1 bit - spi.write(g3_array[0]);//set g0 bit - //set red bits - spi.write(r3_array[7]);//set r7 bit - spi.write(r3_array[6]); //set r6 bit - spi.write(r3_array[5]); //set r5 bit - spi.write(r3_array[4]); //set r4 bit - spi.write(r3_array[3]); //set r3 bit - spi.write(r3_array[2]); //set r2 bit - spi.write(r3_array[1]); //set r1 bit - spi.write(r3_array[0]); //set r0 bit - //set blue bits - spi.write(b3_array[7]); //set b7 bit - spi.write(b3_array[6]); //set b6 bit - spi.write(b3_array[5]); //set b5 bit - spi.write(b3_array[4]); //set b4 bit - spi.write(b3_array[3]); //set b3 bit - spi.write(b3_array[2]); //set b2 bit - spi.write(b3_array[1]); //set b1 bit - spi.write(b3_array[0]); //set b0 bit - //LED2 - //set green bits - spi.write(g3_array[7]); //set g7 bit - spi.write(g3_array[6]); //set g6 bit - spi.write(g3_array[5]); //set g5 bit - spi.write(g3_array[4]); //set g4 bit - spi.write(g3_array[3]); //set g3 bit - spi.write(g3_array[2]); //set g2 bit - spi.write(g3_array[1]); //set g1 bit - spi.write(g3_array[0]);//set g0 bit - //set red bits - spi.write(r3_array[7]);//set r7 bit - spi.write(r3_array[6]); //set r6 bit - spi.write(r3_array[5]); //set r5 bit - spi.write(r3_array[4]); //set r4 bit - spi.write(r3_array[3]); //set r3 bit - spi.write(r3_array[2]); //set r2 bit - spi.write(r3_array[1]); //set r1 bit - spi.write(r3_array[0]); //set r0 bit - //set blue bits - spi.write(b3_array[7]); //set b7 bit - spi.write(b3_array[6]); //set b6 bit - spi.write(b3_array[5]); //set b5 bit - spi.write(b3_array[4]); //set b4 bit - spi.write(b3_array[3]); //set b3 bit - spi.write(b3_array[2]); //set b2 bit - spi.write(b3_array[1]); //set b1 bit - spi.write(b3_array[0]); //set b0 bit - //LED3 - //set green bits - spi.write(g3_array[7]); //set g7 bit - spi.write(g3_array[6]); //set g6 bit - spi.write(g3_array[5]); //set g5 bit - spi.write(g3_array[4]); //set g4 bit - spi.write(g3_array[3]); //set g3 bit - spi.write(g3_array[2]); //set g2 bit - spi.write(g3_array[1]); //set g1 bit - spi.write(g3_array[0]);//set g0 bit - //set red bits - spi.write(r3_array[7]);//set r7 bit - spi.write(r3_array[6]); //set r6 bit - spi.write(r3_array[5]); //set r5 bit - spi.write(r3_array[4]); //set r4 bit - spi.write(r3_array[3]); //set r3 bit - spi.write(r3_array[2]); //set r2 bit - spi.write(r3_array[1]); //set r1 bit - spi.write(r3_array[0]); //set r0 bit - //set blue bits - spi.write(b3_array[7]); //set b7 bit - spi.write(b3_array[6]); //set b6 bit - spi.write(b3_array[5]); //set b5 bit - spi.write(b3_array[4]); //set b4 bit - spi.write(b3_array[3]); //set b3 bit - spi.write(b3_array[2]); //set b2 bit - spi.write(b3_array[1]); //set b1 bit - spi.write(b3_array[0]); //set b0 bit - //LED4 - //set green bits - spi.write(g3_array[7]); //set g7 bit - spi.write(g3_array[6]); //set g6 bit - spi.write(g3_array[5]); //set g5 bit - spi.write(g3_array[4]); //set g4 bit - spi.write(g3_array[3]); //set g3 bit - spi.write(g3_array[2]); //set g2 bit - spi.write(g3_array[1]); //set g1 bit - spi.write(g3_array[0]);//set g0 bit - //set red bits - spi.write(r3_array[7]);//set r7 bit - spi.write(r3_array[6]); //set r6 bit - spi.write(r3_array[5]); //set r5 bit - spi.write(r3_array[4]); //set r4 bit - spi.write(r3_array[3]); //set r3 bit - spi.write(r3_array[2]); //set r2 bit - spi.write(r3_array[1]); //set r1 bit - spi.write(r3_array[0]); //set r0 bit - //set blue bits - spi.write(b3_array[7]); //set b7 bit - spi.write(b3_array[6]); //set b6 bit - spi.write(b3_array[5]); //set b5 bit - spi.write(b3_array[4]); //set b4 bit - spi.write(b3_array[3]); //set b3 bit - spi.write(b3_array[2]); //set b2 bit - spi.write(b3_array[1]); //set b1 bit - spi.write(b3_array[0]); //set b0 bit - //LED5 - //set green bits - spi.write(g3_array[7]); //set g7 bit - spi.write(g3_array[6]); //set g6 bit - spi.write(g3_array[5]); //set g5 bit - spi.write(g3_array[4]); //set g4 bit - spi.write(g3_array[3]); //set g3 bit - spi.write(g3_array[2]); //set g2 bit - spi.write(g3_array[1]); //set g1 bit - spi.write(g3_array[0]);//set g0 bit - //set red bits - spi.write(r3_array[7]);//set r7 bit - spi.write(r3_array[6]); //set r6 bit - spi.write(r3_array[5]); //set r5 bit - spi.write(r3_array[4]); //set r4 bit - spi.write(r3_array[3]); //set r3 bit - spi.write(r3_array[2]); //set r2 bit - spi.write(r3_array[1]); //set r1 bit - spi.write(r3_array[0]); //set r0 bit - //set blue bits - spi.write(b3_array[7]); //set b7 bit - spi.write(b3_array[6]); //set b6 bit - spi.write(b3_array[5]); //set b5 bit - spi.write(b3_array[4]); //set b4 bit - spi.write(b3_array[3]); //set b3 bit - spi.write(b3_array[2]); //set b2 bit - spi.write(b3_array[1]); //set b1 bit - spi.write(b3_array[0]); //set b0 bit - //LED6 - //set green bits - spi.write(g3_array[7]); //set g7 bit - spi.write(g3_array[6]); //set g6 bit - spi.write(g3_array[5]); //set g5 bit - spi.write(g3_array[4]); //set g4 bit - spi.write(g3_array[3]); //set g3 bit - spi.write(g3_array[2]); //set g2 bit - spi.write(g3_array[1]); //set g1 bit - spi.write(g3_array[0]);//set g0 bit - //set red bits - spi.write(r3_array[7]);//set r7 bit - spi.write(r3_array[6]); //set r6 bit - spi.write(r3_array[5]); //set r5 bit - spi.write(r3_array[4]); //set r4 bit - spi.write(r3_array[3]); //set r3 bit - spi.write(r3_array[2]); //set r2 bit - spi.write(r3_array[1]); //set r1 bit - spi.write(r3_array[0]); //set r0 bit - //set blue bits - spi.write(b3_array[7]); //set b7 bit - spi.write(b3_array[6]); //set b6 bit - spi.write(b3_array[5]); //set b5 bit - spi.write(b3_array[4]); //set b4 bit - spi.write(b3_array[3]); //set b3 bit - spi.write(b3_array[2]); //set b2 bit - spi.write(b3_array[1]); //set b1 bit - spi.write(b3_array[0]); //set b0 bit - //LED7 - //set green bits - spi.write(g3_array[7]); //set g7 bit - spi.write(g3_array[6]); //set g6 bit - spi.write(g3_array[5]); //set g5 bit - spi.write(g3_array[4]); //set g4 bit - spi.write(g3_array[3]); //set g3 bit - spi.write(g3_array[2]); //set g2 bit - spi.write(g3_array[1]); //set g1 bit - spi.write(g3_array[0]);//set g0 bit - //set red bits - spi.write(r3_array[7]);//set r7 bit - spi.write(r3_array[6]); //set r6 bit - spi.write(r3_array[5]); //set r5 bit - spi.write(r3_array[4]); //set r4 bit - spi.write(r3_array[3]); //set r3 bit - spi.write(r3_array[2]); //set r2 bit - spi.write(r3_array[1]); //set r1 bit - spi.write(r3_array[0]); //set r0 bit - //set blue bits - spi.write(b3_array[7]); //set b7 bit - spi.write(b3_array[6]); //set b6 bit - spi.write(b3_array[5]); //set b5 bit - spi.write(b3_array[4]); //set b4 bit - spi.write(b3_array[3]); //set b3 bit - spi.write(b3_array[2]); //set b2 bit - spi.write(b3_array[1]); //set b1 bit - spi.write(b3_array[0]); //set b0 bit - //wait for latch - wait_us(60); -} - -void setRGBFloor_2(int room1[8][3], int room2[8][3]){ +void setRGBFloor_1(int room1[8][3], int room2[8][3]){ //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary //room1 int r00_array[8]; //LED0 @@ -2158,7 +1221,7 @@ void setRGBFloor_2(int room3[8][3], int room4[8][3]){ //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary - //room2 + //room3 int r00_array[8]; //LED0 int g00_array[8]; int b00_array[8]; @@ -2264,453 +1327,453 @@ //room3 //LED0 //set green bits - spi.write(g00_array[7]); //set g7 bit - spi.write(g00_array[6]); //set g6 bit - spi.write(g00_array[5]); //set g5 bit - spi.write(g00_array[4]); //set g4 bit - spi.write(g00_array[3]); //set g3 bit - spi.write(g00_array[2]); //set g2 bit - spi.write(g00_array[1]); //set g1 bit - spi.write(g00_array[0]);//set g0 bit + spi2.write(g00_array[7]); //set g7 bit + spi2.write(g00_array[6]); //set g6 bit + spi2.write(g00_array[5]); //set g5 bit + spi2.write(g00_array[4]); //set g4 bit + spi2.write(g00_array[3]); //set g3 bit + spi2.write(g00_array[2]); //set g2 bit + spi2.write(g00_array[1]); //set g1 bit + spi2.write(g00_array[0]);//set g0 bit //set red bits - spi.write(r00_array[7]);//set r7 bit - spi.write(r00_array[6]); //set r6 bit - spi.write(r00_array[5]); //set r5 bit - spi.write(r00_array[4]); //set r4 bit - spi.write(r00_array[3]); //set r3 bit - spi.write(r00_array[2]); //set r2 bit - spi.write(r00_array[1]); //set r1 bit - spi.write(r00_array[0]); //set r0 bit + spi2.write(r00_array[7]);//set r7 bit + spi2.write(r00_array[6]); //set r6 bit + spi2.write(r00_array[5]); //set r5 bit + spi2.write(r00_array[4]); //set r4 bit + spi2.write(r00_array[3]); //set r3 bit + spi2.write(r00_array[2]); //set r2 bit + spi2.write(r00_array[1]); //set r1 bit + spi2.write(r00_array[0]); //set r0 bit //set blue bits - spi.write(b00_array[7]); //set b7 bit - spi.write(b00_array[6]); //set b6 bit - spi.write(b00_array[5]); //set b5 bit - spi.write(b00_array[4]); //set b4 bit - spi.write(b00_array[3]); //set b3 bit - spi.write(b00_array[2]); //set b2 bit - spi.write(b00_array[1]); //set b1 bit - spi.write(b00_array[0]); //set b0 bit + spi2.write(b00_array[7]); //set b7 bit + spi2.write(b00_array[6]); //set b6 bit + spi2.write(b00_array[5]); //set b5 bit + spi2.write(b00_array[4]); //set b4 bit + spi2.write(b00_array[3]); //set b3 bit + spi2.write(b00_array[2]); //set b2 bit + spi2.write(b00_array[1]); //set b1 bit + spi2.write(b00_array[0]); //set b0 bit //LED1 //set green bits - spi.write(g01_array[7]); //set g7 bit - spi.write(g01_array[6]); //set g6 bit - spi.write(g01_array[5]); //set g5 bit - spi.write(g01_array[4]); //set g4 bit - spi.write(g01_array[3]); //set g3 bit - spi.write(g01_array[2]); //set g2 bit - spi.write(g01_array[1]); //set g1 bit - spi.write(g01_array[0]);//set g0 bit + spi2.write(g01_array[7]); //set g7 bit + spi2.write(g01_array[6]); //set g6 bit + spi2.write(g01_array[5]); //set g5 bit + spi2.write(g01_array[4]); //set g4 bit + spi2.write(g01_array[3]); //set g3 bit + spi2.write(g01_array[2]); //set g2 bit + spi2.write(g01_array[1]); //set g1 bit + spi2.write(g01_array[0]);//set g0 bit //set red bits - spi.write(r01_array[7]);//set r7 bit - spi.write(r01_array[6]); //set r6 bit - spi.write(r01_array[5]); //set r5 bit - spi.write(r01_array[4]); //set r4 bit - spi.write(r01_array[3]); //set r3 bit - spi.write(r01_array[2]); //set r2 bit - spi.write(r01_array[1]); //set r1 bit - spi.write(r01_array[0]); //set r0 bit + spi2.write(r01_array[7]);//set r7 bit + spi2.write(r01_array[6]); //set r6 bit + spi2.write(r01_array[5]); //set r5 bit + spi2.write(r01_array[4]); //set r4 bit + spi2.write(r01_array[3]); //set r3 bit + spi2.write(r01_array[2]); //set r2 bit + spi2.write(r01_array[1]); //set r1 bit + spi2.write(r01_array[0]); //set r0 bit //set blue bits - spi.write(b01_array[7]); //set b7 bit - spi.write(b01_array[6]); //set b6 bit - spi.write(b01_array[5]); //set b5 bit - spi.write(b01_array[4]); //set b4 bit - spi.write(b01_array[3]); //set b3 bit - spi.write(b01_array[2]); //set b2 bit - spi.write(b01_array[1]); //set b1 bit - spi.write(b01_array[0]); //set b0 bit + spi2.write(b01_array[7]); //set b7 bit + spi2.write(b01_array[6]); //set b6 bit + spi2.write(b01_array[5]); //set b5 bit + spi2.write(b01_array[4]); //set b4 bit + spi2.write(b01_array[3]); //set b3 bit + spi2.write(b01_array[2]); //set b2 bit + spi2.write(b01_array[1]); //set b1 bit + spi2.write(b01_array[0]); //set b0 bit //LED2 //set green bits - spi.write(g02_array[7]); //set g7 bit - spi.write(g02_array[6]); //set g6 bit - spi.write(g02_array[5]); //set g5 bit - spi.write(g02_array[4]); //set g4 bit - spi.write(g02_array[3]); //set g3 bit - spi.write(g02_array[2]); //set g2 bit - spi.write(g02_array[1]); //set g1 bit - spi.write(g02_array[0]);//set g0 bit + spi2.write(g02_array[7]); //set g7 bit + spi2.write(g02_array[6]); //set g6 bit + spi2.write(g02_array[5]); //set g5 bit + spi2.write(g02_array[4]); //set g4 bit + spi2.write(g02_array[3]); //set g3 bit + spi2.write(g02_array[2]); //set g2 bit + spi2.write(g02_array[1]); //set g1 bit + spi2.write(g02_array[0]);//set g0 bit //set red bits - spi.write(r02_array[7]);//set r7 bit - spi.write(r02_array[6]); //set r6 bit - spi.write(r02_array[5]); //set r5 bit - spi.write(r02_array[4]); //set r4 bit - spi.write(r02_array[3]); //set r3 bit - spi.write(r02_array[2]); //set r2 bit - spi.write(r02_array[1]); //set r1 bit - spi.write(r02_array[0]); //set r0 bit + spi2.write(r02_array[7]);//set r7 bit + spi2.write(r02_array[6]); //set r6 bit + spi2.write(r02_array[5]); //set r5 bit + spi2.write(r02_array[4]); //set r4 bit + spi2.write(r02_array[3]); //set r3 bit + spi2.write(r02_array[2]); //set r2 bit + spi2.write(r02_array[1]); //set r1 bit + spi2.write(r02_array[0]); //set r0 bit //set blue bits - spi.write(b02_array[7]); //set b7 bit - spi.write(b02_array[6]); //set b6 bit - spi.write(b02_array[5]); //set b5 bit - spi.write(b02_array[4]); //set b4 bit - spi.write(b02_array[3]); //set b3 bit - spi.write(b02_array[2]); //set b2 bit - spi.write(b02_array[1]); //set b1 bit - spi.write(b02_array[0]); //set b0 bit + spi2.write(b02_array[7]); //set b7 bit + spi2.write(b02_array[6]); //set b6 bit + spi2.write(b02_array[5]); //set b5 bit + spi2.write(b02_array[4]); //set b4 bit + spi2.write(b02_array[3]); //set b3 bit + spi2.write(b02_array[2]); //set b2 bit + spi2.write(b02_array[1]); //set b1 bit + spi2.write(b02_array[0]); //set b0 bit //LED3 //set green bits - spi.write(g03_array[7]); //set g7 bit - spi.write(g03_array[6]); //set g6 bit - spi.write(g03_array[5]); //set g5 bit - spi.write(g03_array[4]); //set g4 bit - spi.write(g03_array[3]); //set g3 bit - spi.write(g03_array[2]); //set g2 bit - spi.write(g03_array[1]); //set g1 bit - spi.write(g03_array[0]);//set g0 bit + spi2.write(g03_array[7]); //set g7 bit + spi2.write(g03_array[6]); //set g6 bit + spi2.write(g03_array[5]); //set g5 bit + spi2.write(g03_array[4]); //set g4 bit + spi2.write(g03_array[3]); //set g3 bit + spi2.write(g03_array[2]); //set g2 bit + spi2.write(g03_array[1]); //set g1 bit + spi2.write(g03_array[0]);//set g0 bit //set red bits - spi.write(r03_array[7]);//set r7 bit - spi.write(r03_array[6]); //set r6 bit - spi.write(r03_array[5]); //set r5 bit - spi.write(r03_array[4]); //set r4 bit - spi.write(r03_array[3]); //set r3 bit - spi.write(r03_array[2]); //set r2 bit - spi.write(r03_array[1]); //set r1 bit - spi.write(r03_array[0]); //set r0 bit + spi2.write(r03_array[7]);//set r7 bit + spi2.write(r03_array[6]); //set r6 bit + spi2.write(r03_array[5]); //set r5 bit + spi2.write(r03_array[4]); //set r4 bit + spi2.write(r03_array[3]); //set r3 bit + spi2.write(r03_array[2]); //set r2 bit + spi2.write(r03_array[1]); //set r1 bit + spi2.write(r03_array[0]); //set r0 bit //set blue bits - spi.write(b03_array[7]); //set b7 bit - spi.write(b03_array[6]); //set b6 bit - spi.write(b03_array[5]); //set b5 bit - spi.write(b03_array[4]); //set b4 bit - spi.write(b03_array[3]); //set b3 bit - spi.write(b03_array[2]); //set b2 bit - spi.write(b03_array[1]); //set b1 bit - spi.write(b03_array[0]); //set b0 bit + spi2.write(b03_array[7]); //set b7 bit + spi2.write(b03_array[6]); //set b6 bit + spi2.write(b03_array[5]); //set b5 bit + spi2.write(b03_array[4]); //set b4 bit + spi2.write(b03_array[3]); //set b3 bit + spi2.write(b03_array[2]); //set b2 bit + spi2.write(b03_array[1]); //set b1 bit + spi2.write(b03_array[0]); //set b0 bit //LED4 //set green bits - spi.write(g04_array[7]); //set g7 bit - spi.write(g04_array[6]); //set g6 bit - spi.write(g04_array[5]); //set g5 bit - spi.write(g04_array[4]); //set g4 bit - spi.write(g04_array[3]); //set g3 bit - spi.write(g04_array[2]); //set g2 bit - spi.write(g04_array[1]); //set g1 bit - spi.write(g04_array[0]);//set g0 bit + spi2.write(g04_array[7]); //set g7 bit + spi2.write(g04_array[6]); //set g6 bit + spi2.write(g04_array[5]); //set g5 bit + spi2.write(g04_array[4]); //set g4 bit + spi2.write(g04_array[3]); //set g3 bit + spi2.write(g04_array[2]); //set g2 bit + spi2.write(g04_array[1]); //set g1 bit + spi2.write(g04_array[0]);//set g0 bit //set red bits - spi.write(r04_array[7]);//set r7 bit - spi.write(r04_array[6]); //set r6 bit - spi.write(r04_array[5]); //set r5 bit - spi.write(r04_array[4]); //set r4 bit - spi.write(r04_array[3]); //set r3 bit - spi.write(r04_array[2]); //set r2 bit - spi.write(r04_array[1]); //set r1 bit - spi.write(r04_array[0]); //set r0 bit + spi2.write(r04_array[7]);//set r7 bit + spi2.write(r04_array[6]); //set r6 bit + spi2.write(r04_array[5]); //set r5 bit + spi2.write(r04_array[4]); //set r4 bit + spi2.write(r04_array[3]); //set r3 bit + spi2.write(r04_array[2]); //set r2 bit + spi2.write(r04_array[1]); //set r1 bit + spi2.write(r04_array[0]); //set r0 bit //set blue bits - spi.write(b04_array[7]); //set b7 bit - spi.write(b04_array[6]); //set b6 bit - spi.write(b04_array[5]); //set b5 bit - spi.write(b04_array[4]); //set b4 bit - spi.write(b04_array[3]); //set b3 bit - spi.write(b04_array[2]); //set b2 bit - spi.write(b04_array[1]); //set b1 bit - spi.write(b04_array[0]); //set b0 bit + spi2.write(b04_array[7]); //set b7 bit + spi2.write(b04_array[6]); //set b6 bit + spi2.write(b04_array[5]); //set b5 bit + spi2.write(b04_array[4]); //set b4 bit + spi2.write(b04_array[3]); //set b3 bit + spi2.write(b04_array[2]); //set b2 bit + spi2.write(b04_array[1]); //set b1 bit + spi2.write(b04_array[0]); //set b0 bit //LED5 //set green bits - spi.write(g05_array[7]); //set g7 bit - spi.write(g05_array[6]); //set g6 bit - spi.write(g05_array[5]); //set g5 bit - spi.write(g05_array[4]); //set g4 bit - spi.write(g05_array[3]); //set g3 bit - spi.write(g05_array[2]); //set g2 bit - spi.write(g05_array[1]); //set g1 bit - spi.write(g05_array[0]);//set g0 bit + spi2.write(g05_array[7]); //set g7 bit + spi2.write(g05_array[6]); //set g6 bit + spi2.write(g05_array[5]); //set g5 bit + spi2.write(g05_array[4]); //set g4 bit + spi2.write(g05_array[3]); //set g3 bit + spi2.write(g05_array[2]); //set g2 bit + spi2.write(g05_array[1]); //set g1 bit + spi2.write(g05_array[0]);//set g0 bit //set red bits - spi.write(r05_array[7]);//set r7 bit - spi.write(r05_array[6]); //set r6 bit - spi.write(r05_array[5]); //set r5 bit - spi.write(r05_array[4]); //set r4 bit - spi.write(r05_array[3]); //set r3 bit - spi.write(r05_array[2]); //set r2 bit - spi.write(r05_array[1]); //set r1 bit - spi.write(r05_array[0]); //set r0 bit + spi2.write(r05_array[7]);//set r7 bit + spi2.write(r05_array[6]); //set r6 bit + spi2.write(r05_array[5]); //set r5 bit + spi2.write(r05_array[4]); //set r4 bit + spi2.write(r05_array[3]); //set r3 bit + spi2.write(r05_array[2]); //set r2 bit + spi2.write(r05_array[1]); //set r1 bit + spi2.write(r05_array[0]); //set r0 bit //set blue bits - spi.write(b05_array[7]); //set b7 bit - spi.write(b05_array[6]); //set b6 bit - spi.write(b05_array[5]); //set b5 bit - spi.write(b05_array[4]); //set b4 bit - spi.write(b05_array[3]); //set b3 bit - spi.write(b05_array[2]); //set b2 bit - spi.write(b05_array[1]); //set b1 bit - spi.write(b05_array[0]); //set b0 bit + spi2.write(b05_array[7]); //set b7 bit + spi2.write(b05_array[6]); //set b6 bit + spi2.write(b05_array[5]); //set b5 bit + spi2.write(b05_array[4]); //set b4 bit + spi2.write(b05_array[3]); //set b3 bit + spi2.write(b05_array[2]); //set b2 bit + spi2.write(b05_array[1]); //set b1 bit + spi2.write(b05_array[0]); //set b0 bit //LED6 //set green bits - spi.write(g06_array[7]); //set g7 bit - spi.write(g06_array[6]); //set g6 bit - spi.write(g06_array[5]); //set g5 bit - spi.write(g06_array[4]); //set g4 bit - spi.write(g06_array[3]); //set g3 bit - spi.write(g06_array[2]); //set g2 bit - spi.write(g06_array[1]); //set g1 bit - spi.write(g06_array[0]);//set g0 bit + spi2.write(g06_array[7]); //set g7 bit + spi2.write(g06_array[6]); //set g6 bit + spi2.write(g06_array[5]); //set g5 bit + spi2.write(g06_array[4]); //set g4 bit + spi2.write(g06_array[3]); //set g3 bit + spi2.write(g06_array[2]); //set g2 bit + spi2.write(g06_array[1]); //set g1 bit + spi2.write(g06_array[0]);//set g0 bit //set red bits - spi.write(r06_array[7]);//set r7 bit - spi.write(r06_array[6]); //set r6 bit - spi.write(r06_array[5]); //set r5 bit - spi.write(r06_array[4]); //set r4 bit - spi.write(r06_array[3]); //set r3 bit - spi.write(r06_array[2]); //set r2 bit - spi.write(r06_array[1]); //set r1 bit - spi.write(r06_array[0]); //set r0 bit + spi2.write(r06_array[7]);//set r7 bit + spi2.write(r06_array[6]); //set r6 bit + spi2.write(r06_array[5]); //set r5 bit + spi2.write(r06_array[4]); //set r4 bit + spi2.write(r06_array[3]); //set r3 bit + spi2.write(r06_array[2]); //set r2 bit + spi2.write(r06_array[1]); //set r1 bit + spi2.write(r06_array[0]); //set r0 bit //set blue bits - spi.write(b06_array[7]); //set b7 bit - spi.write(b06_array[6]); //set b6 bit - spi.write(b06_array[5]); //set b5 bit - spi.write(b06_array[4]); //set b4 bit - spi.write(b06_array[3]); //set b3 bit - spi.write(b06_array[2]); //set b2 bit - spi.write(b06_array[1]); //set b1 bit - spi.write(b06_array[0]); //set b0 bit + spi2.write(b06_array[7]); //set b7 bit + spi2.write(b06_array[6]); //set b6 bit + spi2.write(b06_array[5]); //set b5 bit + spi2.write(b06_array[4]); //set b4 bit + spi2.write(b06_array[3]); //set b3 bit + spi2.write(b06_array[2]); //set b2 bit + spi2.write(b06_array[1]); //set b1 bit + spi2.write(b06_array[0]); //set b0 bit //LED7 //set green bits - spi.write(g07_array[7]); //set g7 bit - spi.write(g07_array[6]); //set g6 bit - spi.write(g07_array[5]); //set g5 bit - spi.write(g07_array[4]); //set g4 bit - spi.write(g07_array[3]); //set g3 bit - spi.write(g07_array[2]); //set g2 bit - spi.write(g07_array[1]); //set g1 bit - spi.write(g07_array[0]);//set g0 bit + spi2.write(g07_array[7]); //set g7 bit + spi2.write(g07_array[6]); //set g6 bit + spi2.write(g07_array[5]); //set g5 bit + spi2.write(g07_array[4]); //set g4 bit + spi2.write(g07_array[3]); //set g3 bit + spi2.write(g07_array[2]); //set g2 bit + spi2.write(g07_array[1]); //set g1 bit + spi2.write(g07_array[0]);//set g0 bit //set red bits - spi.write(r07_array[7]);//set r7 bit - spi.write(r07_array[6]); //set r6 bit - spi.write(r07_array[5]); //set r5 bit - spi.write(r07_array[4]); //set r4 bit - spi.write(r07_array[3]); //set r3 bit - spi.write(r07_array[2]); //set r2 bit - spi.write(r07_array[1]); //set r1 bit - spi.write(r07_array[0]); //set r0 bit + spi2.write(r07_array[7]);//set r7 bit + spi2.write(r07_array[6]); //set r6 bit + spi2.write(r07_array[5]); //set r5 bit + spi2.write(r07_array[4]); //set r4 bit + spi2.write(r07_array[3]); //set r3 bit + spi2.write(r07_array[2]); //set r2 bit + spi2.write(r07_array[1]); //set r1 bit + spi2.write(r07_array[0]); //set r0 bit //set blue bits - spi.write(b07_array[7]); //set b7 bit - spi.write(b07_array[6]); //set b6 bit - spi.write(b07_array[5]); //set b5 bit - spi.write(b07_array[4]); //set b4 bit - spi.write(b07_array[3]); //set b3 bit - spi.write(b07_array[2]); //set b2 bit - spi.write(b07_array[1]); //set b1 bit - spi.write(b07_array[0]); //set b0 bit + spi2.write(b07_array[7]); //set b7 bit + spi2.write(b07_array[6]); //set b6 bit + spi2.write(b07_array[5]); //set b5 bit + spi2.write(b07_array[4]); //set b4 bit + spi2.write(b07_array[3]); //set b3 bit + spi2.write(b07_array[2]); //set b2 bit + spi2.write(b07_array[1]); //set b1 bit + spi2.write(b07_array[0]); //set b0 bit //room4 //LED0 //set green bits - spi.write(g10_array[7]); //set g7 bit - spi.write(g10_array[6]); //set g6 bit - spi.write(g10_array[5]); //set g5 bit - spi.write(g10_array[4]); //set g4 bit - spi.write(g10_array[3]); //set g3 bit - spi.write(g10_array[2]); //set g2 bit - spi.write(g10_array[1]); //set g1 bit - spi.write(g10_array[0]);//set g0 bit + spi2.write(g10_array[7]); //set g7 bit + spi2.write(g10_array[6]); //set g6 bit + spi2.write(g10_array[5]); //set g5 bit + spi2.write(g10_array[4]); //set g4 bit + spi2.write(g10_array[3]); //set g3 bit + spi2.write(g10_array[2]); //set g2 bit + spi2.write(g10_array[1]); //set g1 bit + spi2.write(g10_array[0]);//set g0 bit //set red bits - spi.write(r10_array[7]);//set r7 bit - spi.write(r10_array[6]); //set r6 bit - spi.write(r10_array[5]); //set r5 bit - spi.write(r10_array[4]); //set r4 bit - spi.write(r10_array[3]); //set r3 bit - spi.write(r10_array[2]); //set r2 bit - spi.write(r10_array[1]); //set r1 bit - spi.write(r10_array[0]); //set r0 bit + spi2.write(r10_array[7]);//set r7 bit + spi2.write(r10_array[6]); //set r6 bit + spi2.write(r10_array[5]); //set r5 bit + spi2.write(r10_array[4]); //set r4 bit + spi2.write(r10_array[3]); //set r3 bit + spi2.write(r10_array[2]); //set r2 bit + spi2.write(r10_array[1]); //set r1 bit + spi2.write(r10_array[0]); //set r0 bit //set blue bits - spi.write(b10_array[7]); //set b7 bit - spi.write(b10_array[6]); //set b6 bit - spi.write(b10_array[5]); //set b5 bit - spi.write(b10_array[4]); //set b4 bit - spi.write(b10_array[3]); //set b3 bit - spi.write(b10_array[2]); //set b2 bit - spi.write(b10_array[1]); //set b1 bit - spi.write(b10_array[0]); //set b0 bit + spi2.write(b10_array[7]); //set b7 bit + spi2.write(b10_array[6]); //set b6 bit + spi2.write(b10_array[5]); //set b5 bit + spi2.write(b10_array[4]); //set b4 bit + spi2.write(b10_array[3]); //set b3 bit + spi2.write(b10_array[2]); //set b2 bit + spi2.write(b10_array[1]); //set b1 bit + spi2.write(b10_array[0]); //set b0 bit //LED1 //set green bits - spi.write(g11_array[7]); //set g7 bit - spi.write(g11_array[6]); //set g6 bit - spi.write(g11_array[5]); //set g5 bit - spi.write(g11_array[4]); //set g4 bit - spi.write(g11_array[3]); //set g3 bit - spi.write(g11_array[2]); //set g2 bit - spi.write(g11_array[1]); //set g1 bit - spi.write(g11_array[0]);//set g0 bit + spi2.write(g11_array[7]); //set g7 bit + spi2.write(g11_array[6]); //set g6 bit + spi2.write(g11_array[5]); //set g5 bit + spi2.write(g11_array[4]); //set g4 bit + spi2.write(g11_array[3]); //set g3 bit + spi2.write(g11_array[2]); //set g2 bit + spi2.write(g11_array[1]); //set g1 bit + spi2.write(g11_array[0]);//set g0 bit //set red bits - spi.write(r11_array[7]);//set r7 bit - spi.write(r11_array[6]); //set r6 bit - spi.write(r11_array[5]); //set r5 bit - spi.write(r11_array[4]); //set r4 bit - spi.write(r11_array[3]); //set r3 bit - spi.write(r11_array[2]); //set r2 bit - spi.write(r11_array[1]); //set r1 bit - spi.write(r11_array[0]); //set r0 bit + spi2.write(r11_array[7]);//set r7 bit + spi2.write(r11_array[6]); //set r6 bit + spi2.write(r11_array[5]); //set r5 bit + spi2.write(r11_array[4]); //set r4 bit + spi2.write(r11_array[3]); //set r3 bit + spi2.write(r11_array[2]); //set r2 bit + spi2.write(r11_array[1]); //set r1 bit + spi2.write(r11_array[0]); //set r0 bit //set blue bits - spi.write(b11_array[7]); //set b7 bit - spi.write(b11_array[6]); //set b6 bit - spi.write(b11_array[5]); //set b5 bit - spi.write(b11_array[4]); //set b4 bit - spi.write(b11_array[3]); //set b3 bit - spi.write(b11_array[2]); //set b2 bit - spi.write(b11_array[1]); //set b1 bit - spi.write(b11_array[0]); //set b0 bit + spi2.write(b11_array[7]); //set b7 bit + spi2.write(b11_array[6]); //set b6 bit + spi2.write(b11_array[5]); //set b5 bit + spi2.write(b11_array[4]); //set b4 bit + spi2.write(b11_array[3]); //set b3 bit + spi2.write(b11_array[2]); //set b2 bit + spi2.write(b11_array[1]); //set b1 bit + spi2.write(b11_array[0]); //set b0 bit //LED2 //set green bits - spi.write(g12_array[7]); //set g7 bit - spi.write(g12_array[6]); //set g6 bit - spi.write(g12_array[5]); //set g5 bit - spi.write(g12_array[4]); //set g4 bit - spi.write(g12_array[3]); //set g3 bit - spi.write(g12_array[2]); //set g2 bit - spi.write(g12_array[1]); //set g1 bit - spi.write(g12_array[0]);//set g0 bit - //set red bits - spi.write(r12_array[7]);//set r7 bit - spi.write(r12_array[6]); //set r6 bit - spi.write(r12_array[5]); //set r5 bit - spi.write(r12_array[4]); //set r4 bit - spi.write(r12_array[3]); //set r3 bit - spi.write(r12_array[2]); //set r2 bit - spi.write(r12_array[1]); //set r1 bit - spi.write(r12_array[0]); //set r0 bit + spi2.write(g12_array[7]); //set g7 bit + spi2.write(g12_array[6]); //set g6 bit + spi2.write(g12_array[5]); //set g5 bit + spi2.write(g12_array[4]); //set g4 bit + spi2.write(g12_array[3]); //set g3 bit + spi2.write(g12_array[2]); //set g2 bit + spi2.write(g12_array[1]); //set g1 bit + spi2.write(g12_array[0]);//set g0 bit + //s2et red bits + spi2.write(r12_array[7]);//set r7 bit + spi2.write(r12_array[6]); //set r6 bit + spi2.write(r12_array[5]); //set r5 bit + spi2.write(r12_array[4]); //set r4 bit + spi2.write(r12_array[3]); //set r3 bit + spi2.write(r12_array[2]); //set r2 bit + spi2.write(r12_array[1]); //set r1 bit + spi2.write(r12_array[0]); //set r0 bit //set blue bits - spi.write(b12_array[7]); //set b7 bit - spi.write(b12_array[6]); //set b6 bit - spi.write(b12_array[5]); //set b5 bit - spi.write(b12_array[4]); //set b4 bit - spi.write(b12_array[3]); //set b3 bit - spi.write(b12_array[2]); //set b2 bit - spi.write(b12_array[1]); //set b1 bit - spi.write(b12_array[0]); //set b0 bit + spi2.write(b12_array[7]); //set b7 bit + spi2.write(b12_array[6]); //set b6 bit + spi2.write(b12_array[5]); //set b5 bit + spi2.write(b12_array[4]); //set b4 bit + spi2.write(b12_array[3]); //set b3 bit + spi2.write(b12_array[2]); //set b2 bit + spi2.write(b12_array[1]); //set b1 bit + spi2.write(b12_array[0]); //set b0 bit //LED3 //set green bits - spi.write(g13_array[7]); //set g7 bit - spi.write(g13_array[6]); //set g6 bit - spi.write(g13_array[5]); //set g5 bit - spi.write(g13_array[4]); //set g4 bit - spi.write(g13_array[3]); //set g3 bit - spi.write(g13_array[2]); //set g2 bit - spi.write(g13_array[1]); //set g1 bit - spi.write(g13_array[0]);//set g0 bit + spi2.write(g13_array[7]); //set g7 bit + spi2.write(g13_array[6]); //set g6 bit + spi2.write(g13_array[5]); //set g5 bit + spi2.write(g13_array[4]); //set g4 bit + spi2.write(g13_array[3]); //set g3 bit + spi2.write(g13_array[2]); //set g2 bit + spi2.write(g13_array[1]); //set g1 bit + spi2.write(g13_array[0]);//set g0 bit //set red bits - spi.write(r13_array[7]);//set r7 bit - spi.write(r13_array[6]); //set r6 bit - spi.write(r13_array[5]); //set r5 bit - spi.write(r13_array[4]); //set r4 bit - spi.write(r13_array[3]); //set r3 bit - spi.write(r13_array[2]); //set r2 bit - spi.write(r13_array[1]); //set r1 bit - spi.write(r13_array[0]); //set r0 bit + spi2.write(r13_array[7]);//set r7 bit + spi2.write(r13_array[6]); //set r6 bit + spi2.write(r13_array[5]); //set r5 bit + spi2.write(r13_array[4]); //set r4 bit + spi2.write(r13_array[3]); //set r3 bit + spi2.write(r13_array[2]); //set r2 bit + spi2.write(r13_array[1]); //set r1 bit + spi2.write(r13_array[0]); //set r0 bit //set blue bits - spi.write(b13_array[7]); //set b7 bit - spi.write(b13_array[6]); //set b6 bit - spi.write(b13_array[5]); //set b5 bit - spi.write(b13_array[4]); //set b4 bit - spi.write(b13_array[3]); //set b3 bit - spi.write(b13_array[2]); //set b2 bit - spi.write(b13_array[1]); //set b1 bit - spi.write(b13_array[0]); //set b0 bit + spi2.write(b13_array[7]); //set b7 bit + spi2.write(b13_array[6]); //set b6 bit + spi2.write(b13_array[5]); //set b5 bit + spi2.write(b13_array[4]); //set b4 bit + spi2.write(b13_array[3]); //set b3 bit + spi2.write(b13_array[2]); //set b2 bit + spi2.write(b13_array[1]); //set b1 bit + spi2.write(b13_array[0]); //set b0 bit //LED4 //set green bits - spi.write(g14_array[7]); //set g7 bit - spi.write(g14_array[6]); //set g6 bit - spi.write(g14_array[5]); //set g5 bit - spi.write(g14_array[4]); //set g4 bit - spi.write(g14_array[3]); //set g3 bit - spi.write(g14_array[2]); //set g2 bit - spi.write(g14_array[1]); //set g1 bit - spi.write(g14_array[0]);//set g0 bit + spi2.write(g14_array[7]); //set g7 bit + spi2.write(g14_array[6]); //set g6 bit + spi2.write(g14_array[5]); //set g5 bit + spi2.write(g14_array[4]); //set g4 bit + spi2.write(g14_array[3]); //set g3 bit + spi2.write(g14_array[2]); //set g2 bit + spi2.write(g14_array[1]); //set g1 bit + spi2.write(g14_array[0]);//set g0 bit //set red bits - spi.write(r14_array[7]);//set r7 bit - spi.write(r14_array[6]); //set r6 bit - spi.write(r14_array[5]); //set r5 bit - spi.write(r14_array[4]); //set r4 bit - spi.write(r14_array[3]); //set r3 bit - spi.write(r14_array[2]); //set r2 bit - spi.write(r14_array[1]); //set r1 bit - spi.write(r14_array[0]); //set r0 bit + spi2.write(r14_array[7]);//set r7 bit + spi2.write(r14_array[6]); //set r6 bit + spi2.write(r14_array[5]); //set r5 bit + spi2.write(r14_array[4]); //set r4 bit + spi2.write(r14_array[3]); //set r3 bit + spi2.write(r14_array[2]); //set r2 bit + spi2.write(r14_array[1]); //set r1 bit + spi2.write(r14_array[0]); //set r0 bit //set blue bits - spi.write(b14_array[7]); //set b7 bit - spi.write(b14_array[6]); //set b6 bit - spi.write(b14_array[5]); //set b5 bit - spi.write(b14_array[4]); //set b4 bit - spi.write(b14_array[3]); //set b3 bit - spi.write(b14_array[2]); //set b2 bit - spi.write(b14_array[1]); //set b1 bit - spi.write(b14_array[0]); //set b0 bit + spi2.write(b14_array[7]); //set b7 bit + spi2.write(b14_array[6]); //set b6 bit + spi2.write(b14_array[5]); //set b5 bit + spi2.write(b14_array[4]); //set b4 bit + spi2.write(b14_array[3]); //set b3 bit + spi2.write(b14_array[2]); //set b2 bit + spi2.write(b14_array[1]); //set b1 bit + spi2.write(b14_array[0]); //set b0 bit //LED5 //set green bits - spi.write(g15_array[7]); //set g7 bit - spi.write(g15_array[6]); //set g6 bit - spi.write(g15_array[5]); //set g5 bit - spi.write(g15_array[4]); //set g4 bit - spi.write(g15_array[3]); //set g3 bit - spi.write(g15_array[2]); //set g2 bit - spi.write(g15_array[1]); //set g1 bit - spi.write(g15_array[0]);//set g0 bit + spi2.write(g15_array[7]); //set g7 bit + spi2.write(g15_array[6]); //set g6 bit + spi2.write(g15_array[5]); //set g5 bit + spi2.write(g15_array[4]); //set g4 bit + spi2.write(g15_array[3]); //set g3 bit + spi2.write(g15_array[2]); //set g2 bit + spi2.write(g15_array[1]); //set g1 bit + spi2.write(g15_array[0]);//set g0 bit //set red bits - spi.write(r15_array[7]);//set r7 bit - spi.write(r15_array[6]); //set r6 bit - spi.write(r15_array[5]); //set r5 bit - spi.write(r15_array[4]); //set r4 bit - spi.write(r15_array[3]); //set r3 bit - spi.write(r15_array[2]); //set r2 bit - spi.write(r15_array[1]); //set r1 bit - spi.write(r15_array[0]); //set r0 bit + spi2.write(r15_array[7]);//set r7 bit + spi2.write(r15_array[6]); //set r6 bit + spi2.write(r15_array[5]); //set r5 bit + spi2.write(r15_array[4]); //set r4 bit + spi2.write(r15_array[3]); //set r3 bit + spi2.write(r15_array[2]); //set r2 bit + spi2.write(r15_array[1]); //set r1 bit + spi2.write(r15_array[0]); //set r0 bit //set blue bits - spi.write(b15_array[7]); //set b7 bit - spi.write(b15_array[6]); //set b6 bit - spi.write(b15_array[5]); //set b5 bit - spi.write(b15_array[4]); //set b4 bit - spi.write(b15_array[3]); //set b3 bit - spi.write(b15_array[2]); //set b2 bit - spi.write(b15_array[1]); //set b1 bit - spi.write(b15_array[0]); //set b0 bit + spi2.write(b15_array[7]); //set b7 bit + spi2.write(b15_array[6]); //set b6 bit + spi2.write(b15_array[5]); //set b5 bit + spi2.write(b15_array[4]); //set b4 bit + spi2.write(b15_array[3]); //set b3 bit + spi2.write(b15_array[2]); //set b2 bit + spi2.write(b15_array[1]); //set b1 bit + spi2.write(b15_array[0]); //set b0 bit //LED6 //set green bits - spi.write(g16_array[7]); //set g7 bit - spi.write(g16_array[6]); //set g6 bit - spi.write(g16_array[5]); //set g5 bit - spi.write(g16_array[4]); //set g4 bit - spi.write(g16_array[3]); //set g3 bit - spi.write(g16_array[2]); //set g2 bit - spi.write(g16_array[1]); //set g1 bit - spi.write(g16_array[0]);//set g0 bit + spi2.write(g16_array[7]); //set g7 bit + spi2.write(g16_array[6]); //set g6 bit + spi2.write(g16_array[5]); //set g5 bit + spi2.write(g16_array[4]); //set g4 bit + spi2.write(g16_array[3]); //set g3 bit + spi2.write(g16_array[2]); //set g2 bit + spi2.write(g16_array[1]); //set g1 bit + spi2.write(g16_array[0]);//set g0 bit //set red bits - spi.write(r16_array[7]);//set r7 bit - spi.write(r16_array[6]); //set r6 bit - spi.write(r16_array[5]); //set r5 bit - spi.write(r16_array[4]); //set r4 bit - spi.write(r16_array[3]); //set r3 bit - spi.write(r16_array[2]); //set r2 bit - spi.write(r16_array[1]); //set r1 bit - spi.write(r16_array[0]); //set r0 bit + spi2.write(r16_array[7]);//set r7 bit + spi2.write(r16_array[6]); //set r6 bit + spi2.write(r16_array[5]); //set r5 bit + spi2.write(r16_array[4]); //set r4 bit + spi2.write(r16_array[3]); //set r3 bit + spi2.write(r16_array[2]); //set r2 bit + spi2.write(r16_array[1]); //set r1 bit + spi2.write(r16_array[0]); //set r0 bit //set blue bits - spi.write(b16_array[7]); //set b7 bit - spi.write(b16_array[6]); //set b6 bit - spi.write(b16_array[5]); //set b5 bit - spi.write(b16_array[4]); //set b4 bit - spi.write(b16_array[3]); //set b3 bit - spi.write(b16_array[2]); //set b2 bit - spi.write(b16_array[1]); //set b1 bit - spi.write(b16_array[0]); //set b0 bit + spi2.write(b16_array[7]); //set b7 bit + spi2.write(b16_array[6]); //set b6 bit + spi2.write(b16_array[5]); //set b5 bit + spi2.write(b16_array[4]); //set b4 bit + spi2.write(b16_array[3]); //set b3 bit + spi2.write(b16_array[2]); //set b2 bit + spi2.write(b16_array[1]); //set b1 bit + spi2.write(b16_array[0]); //set b0 bit //LED7 //set green bits - spi.write(g17_array[7]); //set g7 bit - spi.write(g17_array[6]); //set g6 bit - spi.write(g17_array[5]); //set g5 bit - spi.write(g17_array[4]); //set g4 bit - spi.write(g17_array[3]); //set g3 bit - spi.write(g17_array[2]); //set g2 bit - spi.write(g17_array[1]); //set g1 bit - spi.write(g17_array[0]);//set g0 bit + spi2.write(g17_array[7]); //set g7 bit + spi2.write(g17_array[6]); //set g6 bit + spi2.write(g17_array[5]); //set g5 bit + spi2.write(g17_array[4]); //set g4 bit + spi2.write(g17_array[3]); //set g3 bit + spi2.write(g17_array[2]); //set g2 bit + spi2.write(g17_array[1]); //set g1 bit + spi2.write(g17_array[0]);//set g0 bit //set red bits - spi.write(r17_array[7]);//set r7 bit - spi.write(r17_array[6]); //set r6 bit - spi.write(r17_array[5]); //set r5 bit - spi.write(r17_array[4]); //set r4 bit - spi.write(r17_array[3]); //set r3 bit - spi.write(r17_array[2]); //set r2 bit - spi.write(r17_array[1]); //set r1 bit - spi.write(r17_array[0]); //set r0 bit + spi2.write(r17_array[7]);//set r7 bit + spi2.write(r17_array[6]); //set r6 bit + spi2.write(r17_array[5]); //set r5 bit + spi2.write(r17_array[4]); //set r4 bit + spi2.write(r17_array[3]); //set r3 bit + spi2.write(r17_array[2]); //set r2 bit + spi2.write(r17_array[1]); //set r1 bit + spi2.write(r17_array[0]); //set r0 bit //set blue bits - spi.write(b17_array[7]); //set b7 bit - spi.write(b17_array[6]); //set b6 bit - spi.write(b17_array[5]); //set b5 bit - spi.write(b17_array[4]); //set b4 bit - spi.write(b17_array[3]); //set b3 bit - spi.write(b17_array[2]); //set b2 bit - spi.write(b17_array[1]); //set b1 bit - spi.write(b17_array[0]); //set b0 bit + spi2.write(b17_array[7]); //set b7 bit + spi2.write(b17_array[6]); //set b6 bit + spi2.write(b17_array[5]); //set b5 bit + spi2.write(b17_array[4]); //set b4 bit + spi2.write(b17_array[3]); //set b3 bit + spi2.write(b17_array[2]); //set b2 bit + spi2.write(b17_array[1]); //set b1 bit + spi2.write(b17_array[0]); //set b0 bit //wait for latch wait_us(60); @@ -2741,8 +1804,8 @@ } void spi_init(){ //initializes spi port to send 0 bit length - spi1.format(14, 0); //set spi at 14 bits/byte with clock phase and clock polarity at mode 0 - spi1.frequency(10600000); //set frequency of spi clock at 96/9 - 10.6MHz 94.3 ns bit time length + spi.format(14, 0); //set spi at 14 bits/byte with clock phase and clock polarity at mode 0 + spi.frequency(10600000); //set frequency of spi clock at 96/9 - 10.6MHz 94.3 ns bit time length spi2.format(14, 0); //set spi at 14 bits/byte with clock phase and clock polarity at mode 0 spi2.frequency(10600000); //set frequency of spi clock at 96/9 - 10.6MHz 94.3 ns bit time length