Code to work with NeoPixels

Dependencies:   NeoStrip mbed

Committer:
ivanyohuno
Date:
Thu Apr 23 17:04:03 2015 +0000
Revision:
1:42b43fa7362f
Parent:
0:c350fa2f0c19
Child:
2:35fd99de07b3
changed to use the 2 spi pins of the mbed, 1 per floor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ivanyohuno 0:c350fa2f0c19 1 #include "mbed.h"
ivanyohuno 0:c350fa2f0c19 2 #include <string.h>
ivanyohuno 0:c350fa2f0c19 3 #include <stdio.h>
ivanyohuno 0:c350fa2f0c19 4 #include "NeoStrip.h"
ivanyohuno 0:c350fa2f0c19 5
ivanyohuno 0:c350fa2f0c19 6 /*
ivanyohuno 0:c350fa2f0c19 7 neopixel_spi v03
ivanyohuno 0:c350fa2f0c19 8 Created By: Ivan Yohuno
ivanyohuno 0:c350fa2f0c19 9 SSID: 200717683
ivanyohuno 0:c350fa2f0c19 10
ivanyohuno 0:c350fa2f0c19 11 Notes:
ivanyohuno 0:c350fa2f0c19 12 -Code to be run on WS2812 neopixel LEDs, can run with a single pixel or a strip of max 8 leds connected together
ivanyohuno 0:c350fa2f0c19 13 -Single LED can be connected to power source of 5V but if connected to 5V logic will need to be shifted up from 3.3V to 5V
ivanyohuno 0:c350fa2f0c19 14
ivanyohuno 0:c350fa2f0c19 15 Features:
ivanyohuno 0:c350fa2f0c19 16 -SetRGBPixel // sets colour of one RGB Pixel (the first pixel connected), generally used for testing. Colour is a mix of 3 8 bit values of red, green and blue
ivanyohuno 0:c350fa2f0c19 17 -SetRGBStrip // sets colour of RGB strip of 8
ivanyohuno 0:c350fa2f0c19 18 -setRGBStrips //sets colours of 4 RGB strips of 8
ivanyohuno 0:c350fa2f0c19 19 colours 2D 4x3 matrix:
ivanyohuno 0:c350fa2f0c19 20 {{room 1 strip red, room 1 strip green, room 1 strip blue},
ivanyohuno 0:c350fa2f0c19 21 {room 2 strip red, room 2 strip green, room 3 strip blue},
ivanyohuno 0:c350fa2f0c19 22 {room 3 strip red, room 3 strip green, room 3 strip blue}
ivanyohuno 0:c350fa2f0c19 23 }
ivanyohuno 0:c350fa2f0c19 24 -SetRGBPixels // sets an RGB strip of 8 to individual colours using a 2D 8x3 matrix
ivanyohuno 0:c350fa2f0c19 25 colours 2D 8x3 matrix:
ivanyohuno 0:c350fa2f0c19 26 {{1st pixel red, 1st pixel blue, 1st pixel green},
ivanyohuno 0:c350fa2f0c19 27 {2nd pixel red, 2nd pixel blue, 2nd pixel green},
ivanyohuno 0:c350fa2f0c19 28 {3rd pixel red, 3rd pixel blue, 3rd pixel green},
ivanyohuno 0:c350fa2f0c19 29 {4th pixel red, 4th pixel blue, 4th pixel green},
ivanyohuno 0:c350fa2f0c19 30 {5th pixel red, 5th pixel blue, 5th pixel green},
ivanyohuno 0:c350fa2f0c19 31 {6th pixel red, 6th pixel blue, 6th pixel green},
ivanyohuno 0:c350fa2f0c19 32 {7th pixel red, 7th pixel blue, 7th pixel green},
ivanyohuno 0:c350fa2f0c19 33 {8th pixel red, 8th pixel blue, 8th pixel green}
ivanyohuno 0:c350fa2f0c19 34 }
ivanyohuno 0:c350fa2f0c19 35 -setRGBAll // sets 4 RGB strips of 8 to individual colours using a 3D 8x4x3 matrix
ivanyohuno 0:c350fa2f0c19 36 colours 2D 8x4x3 matrix:
ivanyohuno 0:c350fa2f0c19 37 {room1{1st pixel red, 1st pixel blue, 1st pixel green},
ivanyohuno 0:c350fa2f0c19 38 {2nd pixel red, 2nd pixel blue, 2nd pixel green},
ivanyohuno 0:c350fa2f0c19 39 {3rd pixel red, 3rd pixel blue, 3rd pixel green},
ivanyohuno 0:c350fa2f0c19 40 {4th pixel red, 4th pixel blue, 4th pixel green},
ivanyohuno 0:c350fa2f0c19 41 {5th pixel red, 5th pixel blue, 5th pixel green},
ivanyohuno 0:c350fa2f0c19 42 {6th pixel red, 6th pixel blue, 6th pixel green},
ivanyohuno 0:c350fa2f0c19 43 {7th pixel red, 7th pixel blue, 7th pixel green},
ivanyohuno 0:c350fa2f0c19 44 {8th pixel red, 8th pixel blue, 8th pixel green}
ivanyohuno 0:c350fa2f0c19 45 room2{1st pixel red, 1st pixel blue, 1st pixel green},
ivanyohuno 0:c350fa2f0c19 46 {2nd pixel red, 2nd pixel blue, 2nd pixel green},
ivanyohuno 0:c350fa2f0c19 47 {3rd pixel red, 3rd pixel blue, 3rd pixel green},
ivanyohuno 0:c350fa2f0c19 48 {4th pixel red, 4th pixel blue, 4th pixel green},
ivanyohuno 0:c350fa2f0c19 49 {5th pixel red, 5th pixel blue, 5th pixel green},
ivanyohuno 0:c350fa2f0c19 50 {6th pixel red, 6th pixel blue, 6th pixel green},
ivanyohuno 0:c350fa2f0c19 51 {7th pixel red, 7th pixel blue, 7th pixel green},
ivanyohuno 0:c350fa2f0c19 52 {8th pixel red, 8th pixel blue, 8th pixel green}
ivanyohuno 0:c350fa2f0c19 53 room3{1st pixel red, 1st pixel blue, 1st pixel green},
ivanyohuno 0:c350fa2f0c19 54 {2nd pixel red, 2nd pixel blue, 2nd pixel green},
ivanyohuno 0:c350fa2f0c19 55 {3rd pixel red, 3rd pixel blue, 3rd pixel green},
ivanyohuno 0:c350fa2f0c19 56 {4th pixel red, 4th pixel blue, 4th pixel green},
ivanyohuno 0:c350fa2f0c19 57 {5th pixel red, 5th pixel blue, 5th pixel green},
ivanyohuno 0:c350fa2f0c19 58 {6th pixel red, 6th pixel blue, 6th pixel green},
ivanyohuno 0:c350fa2f0c19 59 {7th pixel red, 7th pixel blue, 7th pixel green},
ivanyohuno 0:c350fa2f0c19 60 {8th pixel red, 8th pixel blue, 8th pixel green}
ivanyohuno 0:c350fa2f0c19 61 room4{1st pixel red, 1st pixel blue, 1st pixel green},
ivanyohuno 0:c350fa2f0c19 62 {2nd pixel red, 2nd pixel blue, 2nd pixel green},
ivanyohuno 0:c350fa2f0c19 63 {3rd pixel red, 3rd pixel blue, 3rd pixel green},
ivanyohuno 0:c350fa2f0c19 64 {4th pixel red, 4th pixel blue, 4th pixel green},
ivanyohuno 0:c350fa2f0c19 65 {5th pixel red, 5th pixel blue, 5th pixel green},
ivanyohuno 0:c350fa2f0c19 66 {6th pixel red, 6th pixel blue, 6th pixel green},
ivanyohuno 0:c350fa2f0c19 67 {7th pixel red, 7th pixel blue, 7th pixel green},
ivanyohuno 0:c350fa2f0c19 68 {8th pixel red, 8th pixel blue, 8th pixel green}
ivanyohuno 0:c350fa2f0c19 69 }
ivanyohuno 0:c350fa2f0c19 70
ivanyohuno 0:c350fa2f0c19 71 */
ivanyohuno 0:c350fa2f0c19 72
ivanyohuno 0:c350fa2f0c19 73 //function declarations
ivanyohuno 0:c350fa2f0c19 74 void setRGBPixel(int r, int g, int b); //sets colour of one RGB Pixel
ivanyohuno 0:c350fa2f0c19 75 void setRGBStrip(int r, int g, int b); //sets colour of a strip of 8 RGB Pixels
ivanyohuno 0:c350fa2f0c19 76 void setRGBStrips(int colours[4][3]); //sets colour of 4 strips of 8 RGB Pixels
ivanyohuno 0:c350fa2f0c19 77 void setRGBPixels(int colours[8][3]); //sets sequence of colours for a strip of 8 RGB Pixels
ivanyohuno 1:42b43fa7362f 78 //void setRGBAll(int colours[4][8][3]); //sets a sequence of colours for 4 strips of 8 RGB Pixels
ivanyohuno 1:42b43fa7362f 79 void setRGBFloor1(int colours[2][8][3]); //sets a sequence of colours for 2 strips of 8 RGB Pixels
ivanyohuno 1:42b43fa7362f 80 void setRGBFloor2(int colours[2][8][3]); //sets a sequence of colours for 2 strips of 8 RGB Pixels
ivanyohuno 1:42b43fa7362f 81
ivanyohuno 1:42b43fa7362f 82
ivanyohuno 0:c350fa2f0c19 83 void spi_init(); //initializes SPI pin at correct bit length and bit rate
ivanyohuno 0:c350fa2f0c19 84 int * decimalToBinary(int n); //converts a decimal value between 0 and 255 to an 8 bit binary array of 0xF00 (0) and 0xFF0 (1)
ivanyohuno 0:c350fa2f0c19 85
ivanyohuno 0:c350fa2f0c19 86 //initialize pins
ivanyohuno 0:c350fa2f0c19 87 DigitalOut volt(p16); //pin for LV voltage
ivanyohuno 1:42b43fa7362f 88 SPI spi1(p5, p6, p7);//pin for SPI communication - p5 MOSI p5 MISO p6 SCLK
ivanyohuno 1:42b43fa7362f 89 SPI spi2(p11, p12, p13);//pin for SPI communication - p5 MOSI p5 MISO p6 SCLK
ivanyohuno 0:c350fa2f0c19 90 NeoStrip strip(p5,8);
ivanyohuno 0:c350fa2f0c19 91
ivanyohuno 0:c350fa2f0c19 92 int main() {
ivanyohuno 0:c350fa2f0c19 93 volt = 1;
ivanyohuno 0:c350fa2f0c19 94 //use either function
ivanyohuno 0:c350fa2f0c19 95 }
ivanyohuno 0:c350fa2f0c19 96
ivanyohuno 0:c350fa2f0c19 97 void setRGBStrip(int r, int g, int b){
ivanyohuno 0:c350fa2f0c19 98 int r_array[8];
ivanyohuno 0:c350fa2f0c19 99 int g_array[8];
ivanyohuno 0:c350fa2f0c19 100 int b_array[8];
ivanyohuno 0:c350fa2f0c19 101 memcpy(r_array, decimalToBinary(r), sizeof(r_array));
ivanyohuno 0:c350fa2f0c19 102 memcpy(g_array, decimalToBinary(g), sizeof(g_array));
ivanyohuno 0:c350fa2f0c19 103 memcpy(b_array, decimalToBinary(b), sizeof(b_array));
ivanyohuno 0:c350fa2f0c19 104
ivanyohuno 0:c350fa2f0c19 105 //send commands to LED Driver
ivanyohuno 0:c350fa2f0c19 106 //initialize SPI
ivanyohuno 0:c350fa2f0c19 107 spi_init();
ivanyohuno 0:c350fa2f0c19 108 //LED0
ivanyohuno 0:c350fa2f0c19 109 //set green bits
ivanyohuno 0:c350fa2f0c19 110 spi.write(g_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 111 spi.write(g_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 112 spi.write(g_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 113 spi.write(g_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 114 spi.write(g_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 115 spi.write(g_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 116 spi.write(g_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 117 spi.write(g_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 118 //set red bits
ivanyohuno 0:c350fa2f0c19 119 spi.write(r_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 120 spi.write(r_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 121 spi.write(r_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 122 spi.write(r_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 123 spi.write(r_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 124 spi.write(r_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 125 spi.write(r_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 126 spi.write(r_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 127 //set blue bits
ivanyohuno 0:c350fa2f0c19 128 spi.write(b_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 129 spi.write(b_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 130 spi.write(b_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 131 spi.write(b_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 132 spi.write(b_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 133 spi.write(b_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 134 spi.write(b_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 135 spi.write(b_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 136 //LED1
ivanyohuno 0:c350fa2f0c19 137 //set green bits
ivanyohuno 0:c350fa2f0c19 138 spi.write(g_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 139 spi.write(g_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 140 spi.write(g_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 141 spi.write(g_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 142 spi.write(g_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 143 spi.write(g_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 144 spi.write(g_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 145 spi.write(g_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 146 //set red bits
ivanyohuno 0:c350fa2f0c19 147 spi.write(r_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 148 spi.write(r_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 149 spi.write(r_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 150 spi.write(r_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 151 spi.write(r_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 152 spi.write(r_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 153 spi.write(r_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 154 spi.write(r_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 155 //set blue bits
ivanyohuno 0:c350fa2f0c19 156 spi.write(b_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 157 spi.write(b_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 158 spi.write(b_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 159 spi.write(b_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 160 spi.write(b_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 161 spi.write(b_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 162 spi.write(b_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 163 spi.write(b_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 164 //LED2
ivanyohuno 0:c350fa2f0c19 165 //set green bits
ivanyohuno 0:c350fa2f0c19 166 spi.write(g_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 167 spi.write(g_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 168 spi.write(g_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 169 spi.write(g_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 170 spi.write(g_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 171 spi.write(g_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 172 spi.write(g_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 173 spi.write(g_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 174 //set red bits
ivanyohuno 0:c350fa2f0c19 175 spi.write(r_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 176 spi.write(r_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 177 spi.write(r_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 178 spi.write(r_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 179 spi.write(r_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 180 spi.write(r_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 181 spi.write(r_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 182 spi.write(r_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 183 //set blue bits
ivanyohuno 0:c350fa2f0c19 184 spi.write(b_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 185 spi.write(b_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 186 spi.write(b_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 187 spi.write(b_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 188 spi.write(b_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 189 spi.write(b_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 190 spi.write(b_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 191 spi.write(b_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 192 //LED3
ivanyohuno 0:c350fa2f0c19 193 //set green bits
ivanyohuno 0:c350fa2f0c19 194 spi.write(g_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 195 spi.write(g_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 196 spi.write(g_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 197 spi.write(g_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 198 spi.write(g_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 199 spi.write(g_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 200 spi.write(g_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 201 spi.write(g_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 202 //set red bits
ivanyohuno 0:c350fa2f0c19 203 spi.write(r_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 204 spi.write(r_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 205 spi.write(r_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 206 spi.write(r_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 207 spi.write(r_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 208 spi.write(r_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 209 spi.write(r_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 210 spi.write(r_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 211 //set blue bits
ivanyohuno 0:c350fa2f0c19 212 spi.write(b_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 213 spi.write(b_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 214 spi.write(b_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 215 spi.write(b_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 216 spi.write(b_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 217 spi.write(b_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 218 spi.write(b_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 219 spi.write(b_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 220 //LED4
ivanyohuno 0:c350fa2f0c19 221 //set green bits
ivanyohuno 0:c350fa2f0c19 222 spi.write(g_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 223 spi.write(g_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 224 spi.write(g_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 225 spi.write(g_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 226 spi.write(g_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 227 spi.write(g_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 228 spi.write(g_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 229 spi.write(g_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 230 //set red bits
ivanyohuno 0:c350fa2f0c19 231 spi.write(r_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 232 spi.write(r_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 233 spi.write(r_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 234 spi.write(r_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 235 spi.write(r_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 236 spi.write(r_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 237 spi.write(r_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 238 spi.write(r_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 239 //set blue bits
ivanyohuno 0:c350fa2f0c19 240 spi.write(b_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 241 spi.write(b_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 242 spi.write(b_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 243 spi.write(b_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 244 spi.write(b_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 245 spi.write(b_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 246 spi.write(b_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 247 spi.write(b_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 248 //LED5
ivanyohuno 0:c350fa2f0c19 249 //set green bits
ivanyohuno 0:c350fa2f0c19 250 spi.write(g_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 251 spi.write(g_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 252 spi.write(g_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 253 spi.write(g_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 254 spi.write(g_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 255 spi.write(g_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 256 spi.write(g_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 257 spi.write(g_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 258 //set red bits
ivanyohuno 0:c350fa2f0c19 259 spi.write(r_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 260 spi.write(r_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 261 spi.write(r_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 262 spi.write(r_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 263 spi.write(r_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 264 spi.write(r_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 265 spi.write(r_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 266 spi.write(r_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 267 //set blue bits
ivanyohuno 0:c350fa2f0c19 268 spi.write(b_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 269 spi.write(b_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 270 spi.write(b_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 271 spi.write(b_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 272 spi.write(b_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 273 spi.write(b_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 274 spi.write(b_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 275 spi.write(b_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 276 //LED6
ivanyohuno 0:c350fa2f0c19 277 //set green bits
ivanyohuno 0:c350fa2f0c19 278
ivanyohuno 0:c350fa2f0c19 279 spi.write(g_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 280 spi.write(g_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 281 spi.write(g_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 282 spi.write(g_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 283 spi.write(g_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 284 spi.write(g_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 285 spi.write(g_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 286 spi.write(g_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 287 //set red bits
ivanyohuno 0:c350fa2f0c19 288 spi.write(r_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 289 spi.write(r_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 290 spi.write(r_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 291 spi.write(r_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 292 spi.write(r_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 293 spi.write(r_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 294 spi.write(r_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 295 spi.write(r_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 296 //set blue bits
ivanyohuno 0:c350fa2f0c19 297 spi.write(b_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 298 spi.write(b_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 299 spi.write(b_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 300 spi.write(b_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 301 spi.write(b_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 302 spi.write(b_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 303 spi.write(b_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 304 spi.write(b_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 305 //LED7
ivanyohuno 0:c350fa2f0c19 306 //set green bits
ivanyohuno 0:c350fa2f0c19 307 /*
ivanyohuno 0:c350fa2f0c19 308 spi.write(g_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 309 spi.write(g_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 310 spi.write(g_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 311 spi.write(g_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 312 spi.write(g_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 313 spi.write(g_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 314 spi.write(g_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 315 spi.write(g_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 316 //set red bits
ivanyohuno 0:c350fa2f0c19 317 spi.write(r_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 318 spi.write(r_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 319 spi.write(r_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 320 spi.write(r_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 321 spi.write(r_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 322 spi.write(r_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 323 spi.write(r_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 324 spi.write(r_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 325 //set blue bits
ivanyohuno 0:c350fa2f0c19 326 spi.write(b_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 327 spi.write(b_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 328 spi.write(b_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 329 spi.write(b_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 330 spi.write(b_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 331 spi.write(b_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 332 spi.write(b_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 333 spi.write(b_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 334 */
ivanyohuno 0:c350fa2f0c19 335 //wait for latch
ivanyohuno 0:c350fa2f0c19 336 wait_us(60);
ivanyohuno 0:c350fa2f0c19 337 }
ivanyohuno 0:c350fa2f0c19 338
ivanyohuno 0:c350fa2f0c19 339
ivanyohuno 0:c350fa2f0c19 340 void setRGBPixel(int r, int g, int b){
ivanyohuno 0:c350fa2f0c19 341 //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary
ivanyohuno 0:c350fa2f0c19 342 int r_array[8];
ivanyohuno 0:c350fa2f0c19 343 int g_array[8];
ivanyohuno 0:c350fa2f0c19 344 int b_array[8];
ivanyohuno 0:c350fa2f0c19 345 memcpy(r_array, decimalToBinary(r), sizeof(r_array));
ivanyohuno 0:c350fa2f0c19 346 memcpy(g_array, decimalToBinary(g), sizeof(g_array));
ivanyohuno 0:c350fa2f0c19 347 memcpy(b_array, decimalToBinary(b), sizeof(b_array));
ivanyohuno 0:c350fa2f0c19 348
ivanyohuno 0:c350fa2f0c19 349 //send commands to LED Driver
ivanyohuno 0:c350fa2f0c19 350 //initialize SPI
ivanyohuno 0:c350fa2f0c19 351 spi_init();
ivanyohuno 0:c350fa2f0c19 352 //set green bits
ivanyohuno 0:c350fa2f0c19 353 spi.write(g_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 354 spi.write(g_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 355 spi.write(g_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 356 spi.write(g_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 357 spi.write(g_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 358 spi.write(g_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 359 spi.write(g_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 360 spi.write(g_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 361 //set red bits
ivanyohuno 0:c350fa2f0c19 362 spi.write(r_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 363 spi.write(r_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 364 spi.write(r_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 365 spi.write(r_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 366 spi.write(r_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 367 spi.write(r_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 368 spi.write(r_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 369 spi.write(r_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 370 //set blue bits
ivanyohuno 0:c350fa2f0c19 371 spi.write(b_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 372 spi.write(b_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 373 spi.write(b_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 374 spi.write(b_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 375 spi.write(b_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 376 spi.write(b_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 377 spi.write(b_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 378 spi.write(b_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 379 //wait for latch
ivanyohuno 0:c350fa2f0c19 380 wait_us(60);
ivanyohuno 0:c350fa2f0c19 381 }
ivanyohuno 0:c350fa2f0c19 382
ivanyohuno 0:c350fa2f0c19 383 void setRGBPixels(int colours[8][3]){
ivanyohuno 0:c350fa2f0c19 384 //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary
ivanyohuno 0:c350fa2f0c19 385 int r0_array[8]; //LED0
ivanyohuno 0:c350fa2f0c19 386 int g0_array[8];
ivanyohuno 0:c350fa2f0c19 387 int b0_array[8];
ivanyohuno 0:c350fa2f0c19 388 memcpy(r0_array, decimalToBinary(colours[0][0]), sizeof(r0_array));
ivanyohuno 0:c350fa2f0c19 389 memcpy(g0_array, decimalToBinary(colours[0][1]), sizeof(g0_array));
ivanyohuno 0:c350fa2f0c19 390 memcpy(b0_array, decimalToBinary(colours[0][2]), sizeof(b0_array));
ivanyohuno 0:c350fa2f0c19 391 int r1_array[8]; //LED1
ivanyohuno 0:c350fa2f0c19 392 int g1_array[8];
ivanyohuno 0:c350fa2f0c19 393 int b1_array[8];
ivanyohuno 0:c350fa2f0c19 394 memcpy(r1_array, decimalToBinary(colours[1][0]), sizeof(r1_array));
ivanyohuno 0:c350fa2f0c19 395 memcpy(g1_array, decimalToBinary(colours[1][1]), sizeof(g1_array));
ivanyohuno 0:c350fa2f0c19 396 memcpy(b1_array, decimalToBinary(colours[1][2]), sizeof(b1_array));
ivanyohuno 0:c350fa2f0c19 397 int r2_array[8]; //LED2
ivanyohuno 0:c350fa2f0c19 398 int g2_array[8];
ivanyohuno 0:c350fa2f0c19 399 int b2_array[8];
ivanyohuno 0:c350fa2f0c19 400 memcpy(r2_array, decimalToBinary(colours[2][0]), sizeof(r2_array));
ivanyohuno 0:c350fa2f0c19 401 memcpy(g2_array, decimalToBinary(colours[2][1]), sizeof(g2_array));
ivanyohuno 0:c350fa2f0c19 402 memcpy(b2_array, decimalToBinary(colours[2][2]), sizeof(b2_array));
ivanyohuno 0:c350fa2f0c19 403 int r3_array[8]; //LED3
ivanyohuno 0:c350fa2f0c19 404 int g3_array[8];
ivanyohuno 0:c350fa2f0c19 405 int b3_array[8];
ivanyohuno 0:c350fa2f0c19 406 memcpy(r3_array, decimalToBinary(colours[3][0]), sizeof(r3_array));
ivanyohuno 0:c350fa2f0c19 407 memcpy(g3_array, decimalToBinary(colours[3][1]), sizeof(g3_array));
ivanyohuno 0:c350fa2f0c19 408 memcpy(b3_array, decimalToBinary(colours[3][2]), sizeof(b3_array));
ivanyohuno 0:c350fa2f0c19 409 int r4_array[8]; //LED4
ivanyohuno 0:c350fa2f0c19 410 int g4_array[8];
ivanyohuno 0:c350fa2f0c19 411 int b4_array[8];
ivanyohuno 0:c350fa2f0c19 412 memcpy(r4_array, decimalToBinary(colours[4][0]), sizeof(r4_array));
ivanyohuno 0:c350fa2f0c19 413 memcpy(g4_array, decimalToBinary(colours[4][1]), sizeof(g4_array));
ivanyohuno 0:c350fa2f0c19 414 memcpy(b4_array, decimalToBinary(colours[4][2]), sizeof(b4_array));
ivanyohuno 0:c350fa2f0c19 415 int r5_array[8]; //LED5
ivanyohuno 0:c350fa2f0c19 416 int g5_array[8];
ivanyohuno 0:c350fa2f0c19 417 int b5_array[8];
ivanyohuno 0:c350fa2f0c19 418 memcpy(r5_array, decimalToBinary(colours[5][0]), sizeof(r5_array));
ivanyohuno 0:c350fa2f0c19 419 memcpy(g5_array, decimalToBinary(colours[5][1]), sizeof(g5_array));
ivanyohuno 0:c350fa2f0c19 420 memcpy(b5_array, decimalToBinary(colours[5][2]), sizeof(b5_array));
ivanyohuno 0:c350fa2f0c19 421 int r6_array[8]; //LED6
ivanyohuno 0:c350fa2f0c19 422 int g6_array[8];
ivanyohuno 0:c350fa2f0c19 423 int b6_array[8];
ivanyohuno 0:c350fa2f0c19 424 memcpy(r6_array, decimalToBinary(colours[6][0]), sizeof(r6_array));
ivanyohuno 0:c350fa2f0c19 425 memcpy(g6_array, decimalToBinary(colours[6][1]), sizeof(g6_array));
ivanyohuno 0:c350fa2f0c19 426 memcpy(b6_array, decimalToBinary(colours[6][2]), sizeof(b6_array));
ivanyohuno 0:c350fa2f0c19 427 int r7_array[8]; //LED7
ivanyohuno 0:c350fa2f0c19 428 int g7_array[8];
ivanyohuno 0:c350fa2f0c19 429 int b7_array[8];
ivanyohuno 0:c350fa2f0c19 430 memcpy(r7_array, decimalToBinary(colours[7][0]), sizeof(r7_array));
ivanyohuno 0:c350fa2f0c19 431 memcpy(g7_array, decimalToBinary(colours[7][1]), sizeof(g7_array));
ivanyohuno 0:c350fa2f0c19 432 memcpy(b7_array, decimalToBinary(colours[7][2]), sizeof(b7_array));
ivanyohuno 0:c350fa2f0c19 433
ivanyohuno 0:c350fa2f0c19 434 //send commands to LED Driver
ivanyohuno 0:c350fa2f0c19 435 //initialize SPI
ivanyohuno 0:c350fa2f0c19 436 spi_init();
ivanyohuno 0:c350fa2f0c19 437 //LED0
ivanyohuno 0:c350fa2f0c19 438 //set green bits
ivanyohuno 0:c350fa2f0c19 439 spi.write(g0_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 440 spi.write(g0_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 441 spi.write(g0_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 442 spi.write(g0_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 443 spi.write(g0_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 444 spi.write(g0_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 445 spi.write(g0_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 446 spi.write(g0_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 447 //set red bits
ivanyohuno 0:c350fa2f0c19 448 spi.write(r0_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 449 spi.write(r0_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 450 spi.write(r0_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 451 spi.write(r0_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 452 spi.write(r0_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 453 spi.write(r0_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 454 spi.write(r0_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 455 spi.write(r0_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 456 //set blue bits
ivanyohuno 0:c350fa2f0c19 457 spi.write(b0_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 458 spi.write(b0_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 459 spi.write(b0_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 460 spi.write(b0_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 461 spi.write(b0_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 462 spi.write(b0_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 463 spi.write(b0_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 464 spi.write(b0_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 465 //LED1
ivanyohuno 0:c350fa2f0c19 466 //set green bits
ivanyohuno 0:c350fa2f0c19 467 spi.write(g1_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 468 spi.write(g1_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 469 spi.write(g1_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 470 spi.write(g1_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 471 spi.write(g1_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 472 spi.write(g1_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 473 spi.write(g1_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 474 spi.write(g1_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 475 //set red bits
ivanyohuno 0:c350fa2f0c19 476 spi.write(r1_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 477 spi.write(r1_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 478 spi.write(r1_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 479 spi.write(r1_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 480 spi.write(r1_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 481 spi.write(r1_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 482 spi.write(r1_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 483 spi.write(r1_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 484 //set blue bits
ivanyohuno 0:c350fa2f0c19 485 spi.write(b1_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 486 spi.write(b1_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 487 spi.write(b1_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 488 spi.write(b1_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 489 spi.write(b1_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 490 spi.write(b1_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 491 spi.write(b1_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 492 spi.write(b1_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 493 //LED2
ivanyohuno 0:c350fa2f0c19 494 //set green bits
ivanyohuno 0:c350fa2f0c19 495 spi.write(g2_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 496 spi.write(g2_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 497 spi.write(g2_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 498 spi.write(g2_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 499 spi.write(g2_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 500 spi.write(g2_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 501 spi.write(g2_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 502 spi.write(g2_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 503 //set red bits
ivanyohuno 0:c350fa2f0c19 504 spi.write(r2_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 505 spi.write(r2_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 506 spi.write(r2_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 507 spi.write(r2_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 508 spi.write(r2_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 509 spi.write(r2_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 510 spi.write(r2_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 511 spi.write(r2_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 512 //set blue bits
ivanyohuno 0:c350fa2f0c19 513 spi.write(b2_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 514 spi.write(b2_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 515 spi.write(b2_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 516 spi.write(b2_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 517 spi.write(b2_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 518 spi.write(b2_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 519 spi.write(b2_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 520 spi.write(b2_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 521 //LED3
ivanyohuno 0:c350fa2f0c19 522 //set green bits
ivanyohuno 0:c350fa2f0c19 523 spi.write(g3_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 524 spi.write(g3_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 525 spi.write(g3_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 526 spi.write(g3_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 527 spi.write(g3_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 528 spi.write(g3_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 529 spi.write(g3_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 530 spi.write(g3_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 531 //set red bits
ivanyohuno 0:c350fa2f0c19 532 spi.write(r3_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 533 spi.write(r3_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 534 spi.write(r3_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 535 spi.write(r3_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 536 spi.write(r3_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 537 spi.write(r3_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 538 spi.write(r3_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 539 spi.write(r3_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 540 //set blue bits
ivanyohuno 0:c350fa2f0c19 541 spi.write(b3_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 542 spi.write(b3_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 543 spi.write(b3_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 544 spi.write(b3_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 545 spi.write(b3_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 546 spi.write(b3_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 547 spi.write(b3_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 548 spi.write(b3_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 549 //LED4
ivanyohuno 0:c350fa2f0c19 550 //set green bits
ivanyohuno 0:c350fa2f0c19 551 spi.write(g4_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 552 spi.write(g4_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 553 spi.write(g4_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 554 spi.write(g4_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 555 spi.write(g4_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 556 spi.write(g4_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 557 spi.write(g4_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 558 spi.write(g4_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 559 //set red bits
ivanyohuno 0:c350fa2f0c19 560 spi.write(r4_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 561 spi.write(r4_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 562 spi.write(r4_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 563 spi.write(r4_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 564 spi.write(r4_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 565 spi.write(r4_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 566 spi.write(r4_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 567 spi.write(r4_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 568 //set blue bits
ivanyohuno 0:c350fa2f0c19 569 spi.write(b4_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 570 spi.write(b4_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 571 spi.write(b4_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 572 spi.write(b4_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 573 spi.write(b4_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 574 spi.write(b4_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 575 spi.write(b4_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 576 spi.write(b4_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 577 //LED5
ivanyohuno 0:c350fa2f0c19 578 //set green bits
ivanyohuno 0:c350fa2f0c19 579 spi.write(g5_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 580 spi.write(g5_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 581 spi.write(g5_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 582 spi.write(g5_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 583 spi.write(g5_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 584 spi.write(g5_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 585 spi.write(g5_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 586 spi.write(g5_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 587 //set red bits
ivanyohuno 0:c350fa2f0c19 588 spi.write(r5_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 589 spi.write(r5_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 590 spi.write(r5_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 591 spi.write(r5_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 592 spi.write(r5_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 593 spi.write(r5_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 594 spi.write(r5_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 595 spi.write(r5_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 596 //set blue bits
ivanyohuno 0:c350fa2f0c19 597 spi.write(b5_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 598 spi.write(b5_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 599 spi.write(b5_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 600 spi.write(b5_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 601 spi.write(b5_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 602 spi.write(b5_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 603 spi.write(b5_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 604 spi.write(b5_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 605 //LED6
ivanyohuno 0:c350fa2f0c19 606 //set green bits
ivanyohuno 0:c350fa2f0c19 607 spi.write(g6_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 608 spi.write(g6_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 609 spi.write(g6_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 610 spi.write(g6_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 611 spi.write(g6_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 612 spi.write(g6_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 613 spi.write(g6_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 614 spi.write(g6_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 615 //set red bits
ivanyohuno 0:c350fa2f0c19 616 spi.write(r6_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 617 spi.write(r6_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 618 spi.write(r6_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 619 spi.write(r6_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 620 spi.write(r6_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 621 spi.write(r6_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 622 spi.write(r6_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 623 spi.write(r6_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 624 //set blue bits
ivanyohuno 0:c350fa2f0c19 625 spi.write(b6_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 626 spi.write(b6_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 627 spi.write(b6_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 628 spi.write(b6_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 629 spi.write(b6_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 630 spi.write(b6_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 631 spi.write(b6_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 632 spi.write(b6_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 633 //LED7
ivanyohuno 0:c350fa2f0c19 634 //set green bits
ivanyohuno 0:c350fa2f0c19 635 spi.write(g7_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 636 spi.write(g7_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 637 spi.write(g7_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 638 spi.write(g7_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 639 spi.write(g7_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 640 spi.write(g7_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 641 spi.write(g7_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 642 spi.write(g7_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 643 //set red bits
ivanyohuno 0:c350fa2f0c19 644 spi.write(r7_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 645 spi.write(r7_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 646 spi.write(r7_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 647 spi.write(r7_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 648 spi.write(r7_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 649 spi.write(r7_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 650 spi.write(r7_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 651 spi.write(r7_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 652 //set blue bits
ivanyohuno 0:c350fa2f0c19 653 spi.write(b7_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 654 spi.write(b7_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 655 spi.write(b7_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 656 spi.write(b7_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 657 spi.write(b7_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 658 spi.write(b7_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 659 spi.write(b7_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 660 spi.write(b7_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 661 //wait for latch
ivanyohuno 0:c350fa2f0c19 662 wait_us(60);
ivanyohuno 0:c350fa2f0c19 663 }
ivanyohuno 0:c350fa2f0c19 664
ivanyohuno 0:c350fa2f0c19 665 void setRGBStrips(int colours[4][3]){
ivanyohuno 0:c350fa2f0c19 666 //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary
ivanyohuno 0:c350fa2f0c19 667 int r0_array[8]; //room1
ivanyohuno 0:c350fa2f0c19 668 int g0_array[8];
ivanyohuno 0:c350fa2f0c19 669 int b0_array[8];
ivanyohuno 0:c350fa2f0c19 670 memcpy(r0_array, decimalToBinary(colours[0][0]), sizeof(r0_array));
ivanyohuno 0:c350fa2f0c19 671 memcpy(g0_array, decimalToBinary(colours[0][1]), sizeof(g0_array));
ivanyohuno 0:c350fa2f0c19 672 memcpy(b0_array, decimalToBinary(colours[0][2]), sizeof(b0_array));
ivanyohuno 0:c350fa2f0c19 673 int r1_array[8]; //room2
ivanyohuno 0:c350fa2f0c19 674 int g1_array[8];
ivanyohuno 0:c350fa2f0c19 675 int b1_array[8];
ivanyohuno 0:c350fa2f0c19 676 memcpy(r1_array, decimalToBinary(colours[1][0]), sizeof(r1_array));
ivanyohuno 0:c350fa2f0c19 677 memcpy(g1_array, decimalToBinary(colours[1][1]), sizeof(g1_array));
ivanyohuno 0:c350fa2f0c19 678 memcpy(b1_array, decimalToBinary(colours[1][2]), sizeof(b1_array));
ivanyohuno 0:c350fa2f0c19 679 int r2_array[8]; //room3
ivanyohuno 0:c350fa2f0c19 680 int g2_array[8];
ivanyohuno 0:c350fa2f0c19 681 int b2_array[8];
ivanyohuno 0:c350fa2f0c19 682 memcpy(r2_array, decimalToBinary(colours[2][0]), sizeof(r2_array));
ivanyohuno 0:c350fa2f0c19 683 memcpy(g2_array, decimalToBinary(colours[2][1]), sizeof(g2_array));
ivanyohuno 0:c350fa2f0c19 684 memcpy(b2_array, decimalToBinary(colours[2][2]), sizeof(b2_array));
ivanyohuno 0:c350fa2f0c19 685 int r3_array[8]; //room4
ivanyohuno 0:c350fa2f0c19 686 int g3_array[8];
ivanyohuno 0:c350fa2f0c19 687 int b3_array[8];
ivanyohuno 0:c350fa2f0c19 688 memcpy(r3_array, decimalToBinary(colours[3][0]), sizeof(r3_array));
ivanyohuno 0:c350fa2f0c19 689 memcpy(g3_array, decimalToBinary(colours[3][1]), sizeof(g3_array));
ivanyohuno 0:c350fa2f0c19 690 memcpy(b3_array, decimalToBinary(colours[3][2]), sizeof(b3_array));
ivanyohuno 0:c350fa2f0c19 691
ivanyohuno 0:c350fa2f0c19 692 //send commands to LED Driver
ivanyohuno 0:c350fa2f0c19 693 //initialize SPI
ivanyohuno 0:c350fa2f0c19 694 spi_init();
ivanyohuno 0:c350fa2f0c19 695 //room 1
ivanyohuno 0:c350fa2f0c19 696 //LED0
ivanyohuno 0:c350fa2f0c19 697 //set green bits
ivanyohuno 0:c350fa2f0c19 698 spi.write(g0_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 699 spi.write(g0_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 700 spi.write(g0_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 701 spi.write(g0_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 702 spi.write(g0_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 703 spi.write(g0_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 704 spi.write(g0_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 705 spi.write(g0_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 706 //set red bits
ivanyohuno 0:c350fa2f0c19 707 spi.write(r0_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 708 spi.write(r0_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 709 spi.write(r0_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 710 spi.write(r0_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 711 spi.write(r0_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 712 spi.write(r0_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 713 spi.write(r0_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 714 spi.write(r0_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 715 //set blue bits
ivanyohuno 0:c350fa2f0c19 716 spi.write(b0_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 717 spi.write(b0_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 718 spi.write(b0_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 719 spi.write(b0_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 720 spi.write(b0_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 721 spi.write(b0_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 722 spi.write(b0_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 723 spi.write(b0_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 724 //LED1
ivanyohuno 0:c350fa2f0c19 725 //set green bits
ivanyohuno 0:c350fa2f0c19 726 spi.write(g0_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 727 spi.write(g0_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 728 spi.write(g0_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 729 spi.write(g0_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 730 spi.write(g0_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 731 spi.write(g0_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 732 spi.write(g0_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 733 spi.write(g0_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 734 //set red bits
ivanyohuno 0:c350fa2f0c19 735 spi.write(r0_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 736 spi.write(r0_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 737 spi.write(r0_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 738 spi.write(r0_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 739 spi.write(r0_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 740 spi.write(r0_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 741 spi.write(r0_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 742 spi.write(r0_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 743 //set blue bits
ivanyohuno 0:c350fa2f0c19 744 spi.write(b0_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 745 spi.write(b0_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 746 spi.write(b0_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 747 spi.write(b0_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 748 spi.write(b0_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 749 spi.write(b0_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 750 spi.write(b0_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 751 spi.write(b0_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 752 //LED2
ivanyohuno 0:c350fa2f0c19 753 //set green bits
ivanyohuno 0:c350fa2f0c19 754 spi.write(g0_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 755 spi.write(g0_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 756 spi.write(g0_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 757 spi.write(g0_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 758 spi.write(g0_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 759 spi.write(g0_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 760 spi.write(g0_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 761 spi.write(g0_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 762 //set red bits
ivanyohuno 0:c350fa2f0c19 763 spi.write(r0_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 764 spi.write(r0_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 765 spi.write(r0_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 766 spi.write(r0_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 767 spi.write(r0_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 768 spi.write(r0_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 769 spi.write(r0_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 770 spi.write(r0_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 771 //set blue bits
ivanyohuno 0:c350fa2f0c19 772 spi.write(b0_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 773 spi.write(b0_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 774 spi.write(b0_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 775 spi.write(b0_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 776 spi.write(b0_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 777 spi.write(b0_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 778 spi.write(b0_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 779 spi.write(b0_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 780 //LED3
ivanyohuno 0:c350fa2f0c19 781 //set green bits
ivanyohuno 0:c350fa2f0c19 782 spi.write(g0_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 783 spi.write(g0_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 784 spi.write(g0_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 785 spi.write(g0_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 786 spi.write(g0_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 787 spi.write(g0_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 788 spi.write(g0_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 789 spi.write(g0_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 790 //set red bits
ivanyohuno 0:c350fa2f0c19 791 spi.write(r0_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 792 spi.write(r0_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 793 spi.write(r0_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 794 spi.write(r0_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 795 spi.write(r0_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 796 spi.write(r0_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 797 spi.write(r0_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 798 spi.write(r0_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 799 //set blue bits
ivanyohuno 0:c350fa2f0c19 800 spi.write(b0_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 801 spi.write(b0_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 802 spi.write(b0_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 803 spi.write(b0_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 804 spi.write(b0_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 805 spi.write(b0_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 806 spi.write(b0_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 807 spi.write(b0_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 808 //LED4
ivanyohuno 0:c350fa2f0c19 809 //set green bits
ivanyohuno 0:c350fa2f0c19 810 spi.write(g0_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 811 spi.write(g0_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 812 spi.write(g0_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 813 spi.write(g0_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 814 spi.write(g0_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 815 spi.write(g0_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 816 spi.write(g0_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 817 spi.write(g0_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 818 //set red bits
ivanyohuno 0:c350fa2f0c19 819 spi.write(r0_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 820 spi.write(r0_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 821 spi.write(r0_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 822 spi.write(r0_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 823 spi.write(r0_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 824 spi.write(r0_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 825 spi.write(r0_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 826 spi.write(r0_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 827 //set blue bits
ivanyohuno 0:c350fa2f0c19 828 spi.write(b0_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 829 spi.write(b0_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 830 spi.write(b0_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 831 spi.write(b0_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 832 spi.write(b0_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 833 spi.write(b0_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 834 spi.write(b0_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 835 spi.write(b0_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 836 //LED5
ivanyohuno 0:c350fa2f0c19 837 //set green bits
ivanyohuno 0:c350fa2f0c19 838 spi.write(g0_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 839 spi.write(g0_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 840 spi.write(g0_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 841 spi.write(g0_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 842 spi.write(g0_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 843 spi.write(g0_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 844 spi.write(g0_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 845 spi.write(g0_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 846 //set red bits
ivanyohuno 0:c350fa2f0c19 847 spi.write(r0_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 848 spi.write(r0_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 849 spi.write(r0_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 850 spi.write(r0_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 851 spi.write(r0_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 852 spi.write(r0_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 853 spi.write(r0_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 854 spi.write(r0_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 855 //set blue bits
ivanyohuno 0:c350fa2f0c19 856 spi.write(b0_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 857 spi.write(b0_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 858 spi.write(b0_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 859 spi.write(b0_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 860 spi.write(b0_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 861 spi.write(b0_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 862 spi.write(b0_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 863 spi.write(b0_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 864 //LED6
ivanyohuno 0:c350fa2f0c19 865 //set green bits
ivanyohuno 0:c350fa2f0c19 866 spi.write(g0_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 867 spi.write(g0_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 868 spi.write(g0_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 869 spi.write(g0_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 870 spi.write(g0_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 871 spi.write(g0_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 872 spi.write(g0_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 873 spi.write(g0_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 874 //set red bits
ivanyohuno 0:c350fa2f0c19 875 spi.write(r0_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 876 spi.write(r0_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 877 spi.write(r0_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 878 spi.write(r0_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 879 spi.write(r0_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 880 spi.write(r0_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 881 spi.write(r0_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 882 spi.write(r0_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 883 //set blue bits
ivanyohuno 0:c350fa2f0c19 884 spi.write(b0_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 885 spi.write(b0_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 886 spi.write(b0_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 887 spi.write(b0_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 888 spi.write(b0_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 889 spi.write(b0_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 890 spi.write(b0_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 891 spi.write(b0_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 892 //LED7
ivanyohuno 0:c350fa2f0c19 893 //set green bits
ivanyohuno 0:c350fa2f0c19 894 spi.write(g0_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 895 spi.write(g0_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 896 spi.write(g0_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 897 spi.write(g0_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 898 spi.write(g0_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 899 spi.write(g0_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 900 spi.write(g0_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 901 spi.write(g0_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 902 //set red bits
ivanyohuno 0:c350fa2f0c19 903 spi.write(r0_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 904 spi.write(r0_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 905 spi.write(r0_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 906 spi.write(r0_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 907 spi.write(r0_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 908 spi.write(r0_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 909 spi.write(r0_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 910 spi.write(r0_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 911 //set blue bits
ivanyohuno 0:c350fa2f0c19 912 spi.write(b0_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 913 spi.write(b0_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 914 spi.write(b0_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 915 spi.write(b0_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 916 spi.write(b0_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 917 spi.write(b0_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 918 spi.write(b0_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 919 spi.write(b0_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 920 //room 2
ivanyohuno 0:c350fa2f0c19 921 //LED0
ivanyohuno 0:c350fa2f0c19 922 //set green bits
ivanyohuno 0:c350fa2f0c19 923 spi.write(g1_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 924 spi.write(g1_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 925 spi.write(g1_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 926 spi.write(g1_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 927 spi.write(g1_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 928 spi.write(g1_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 929 spi.write(g1_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 930 spi.write(g1_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 931 //set red bits
ivanyohuno 0:c350fa2f0c19 932 spi.write(r1_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 933 spi.write(r1_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 934 spi.write(r1_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 935 spi.write(r1_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 936 spi.write(r1_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 937 spi.write(r1_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 938 spi.write(r1_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 939 spi.write(r1_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 940 //set blue bits
ivanyohuno 0:c350fa2f0c19 941 spi.write(b1_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 942 spi.write(b1_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 943 spi.write(b1_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 944 spi.write(b1_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 945 spi.write(b1_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 946 spi.write(b1_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 947 spi.write(b1_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 948 spi.write(b1_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 949 //LED1
ivanyohuno 0:c350fa2f0c19 950 //set green bits
ivanyohuno 0:c350fa2f0c19 951 spi.write(g1_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 952 spi.write(g1_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 953 spi.write(g1_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 954 spi.write(g1_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 955 spi.write(g1_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 956 spi.write(g1_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 957 spi.write(g1_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 958 spi.write(g1_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 959 //set red bits
ivanyohuno 0:c350fa2f0c19 960 spi.write(r1_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 961 spi.write(r1_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 962 spi.write(r1_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 963 spi.write(r1_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 964 spi.write(r1_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 965 spi.write(r1_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 966 spi.write(r1_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 967 spi.write(r1_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 968 //set blue bits
ivanyohuno 0:c350fa2f0c19 969 spi.write(b1_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 970 spi.write(b1_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 971 spi.write(b1_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 972 spi.write(b1_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 973 spi.write(b1_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 974 spi.write(b1_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 975 spi.write(b1_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 976 spi.write(b1_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 977 //LED2
ivanyohuno 0:c350fa2f0c19 978 //set green bits
ivanyohuno 0:c350fa2f0c19 979 spi.write(g1_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 980 spi.write(g1_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 981 spi.write(g1_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 982 spi.write(g1_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 983 spi.write(g1_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 984 spi.write(g1_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 985 spi.write(g1_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 986 spi.write(g1_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 987 //set red bits
ivanyohuno 0:c350fa2f0c19 988 spi.write(r1_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 989 spi.write(r1_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 990 spi.write(r1_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 991 spi.write(r1_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 992 spi.write(r1_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 993 spi.write(r1_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 994 spi.write(r1_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 995 spi.write(r1_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 996 //set blue bits
ivanyohuno 0:c350fa2f0c19 997 spi.write(b1_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 998 spi.write(b1_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 999 spi.write(b1_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1000 spi.write(b1_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1001 spi.write(b1_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1002 spi.write(b1_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1003 spi.write(b1_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1004 spi.write(b1_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1005 //LED3
ivanyohuno 0:c350fa2f0c19 1006 //set green bits
ivanyohuno 0:c350fa2f0c19 1007 spi.write(g1_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1008 spi.write(g1_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1009 spi.write(g1_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1010 spi.write(g1_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1011 spi.write(g1_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1012 spi.write(g1_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1013 spi.write(g1_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1014 spi.write(g1_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1015 //set red bits
ivanyohuno 0:c350fa2f0c19 1016 spi.write(r1_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1017 spi.write(r1_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1018 spi.write(r1_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1019 spi.write(r1_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1020 spi.write(r1_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1021 spi.write(r1_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1022 spi.write(r1_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1023 spi.write(r1_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1024 //set blue bits
ivanyohuno 0:c350fa2f0c19 1025 spi.write(b1_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1026 spi.write(b1_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1027 spi.write(b1_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1028 spi.write(b1_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1029 spi.write(b1_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1030 spi.write(b1_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1031 spi.write(b1_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1032 spi.write(b1_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1033 //LED4
ivanyohuno 0:c350fa2f0c19 1034 //set green bits
ivanyohuno 0:c350fa2f0c19 1035 spi.write(g1_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1036 spi.write(g1_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1037 spi.write(g1_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1038 spi.write(g1_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1039 spi.write(g1_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1040 spi.write(g1_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1041 spi.write(g1_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1042 spi.write(g1_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1043 //set red bits
ivanyohuno 0:c350fa2f0c19 1044 spi.write(r1_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1045 spi.write(r1_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1046 spi.write(r1_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1047 spi.write(r1_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1048 spi.write(r1_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1049 spi.write(r1_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1050 spi.write(r1_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1051 spi.write(r1_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1052 //set blue bits
ivanyohuno 0:c350fa2f0c19 1053 spi.write(b1_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1054 spi.write(b1_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1055 spi.write(b1_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1056 spi.write(b1_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1057 spi.write(b1_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1058 spi.write(b1_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1059 spi.write(b1_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1060 spi.write(b1_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1061 //LED5
ivanyohuno 0:c350fa2f0c19 1062 //set green bits
ivanyohuno 0:c350fa2f0c19 1063 spi.write(g1_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1064 spi.write(g1_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1065 spi.write(g1_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1066 spi.write(g1_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1067 spi.write(g1_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1068 spi.write(g1_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1069 spi.write(g1_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1070 spi.write(g1_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1071 //set red bits
ivanyohuno 0:c350fa2f0c19 1072 spi.write(r1_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1073 spi.write(r1_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1074 spi.write(r1_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1075 spi.write(r1_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1076 spi.write(r1_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1077 spi.write(r1_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1078 spi.write(r1_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1079 spi.write(r1_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1080 //set blue bits
ivanyohuno 0:c350fa2f0c19 1081 spi.write(b1_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1082 spi.write(b1_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1083 spi.write(b1_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1084 spi.write(b1_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1085 spi.write(b1_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1086 spi.write(b1_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1087 spi.write(b1_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1088 spi.write(b1_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1089 //LED6
ivanyohuno 0:c350fa2f0c19 1090 //set green bits
ivanyohuno 0:c350fa2f0c19 1091 spi.write(g1_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1092 spi.write(g1_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1093 spi.write(g1_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1094 spi.write(g1_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1095 spi.write(g1_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1096 spi.write(g1_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1097 spi.write(g1_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1098 spi.write(g1_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1099 //set red bits
ivanyohuno 0:c350fa2f0c19 1100 spi.write(r1_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1101 spi.write(r1_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1102 spi.write(r1_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1103 spi.write(r1_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1104 spi.write(r1_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1105 spi.write(r1_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1106 spi.write(r1_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1107 spi.write(r1_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1108 //set blue bits
ivanyohuno 0:c350fa2f0c19 1109 spi.write(b1_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1110 spi.write(b1_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1111 spi.write(b1_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1112 spi.write(b1_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1113 spi.write(b1_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1114 spi.write(b1_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1115 spi.write(b1_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1116 spi.write(b1_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1117 //LED7
ivanyohuno 0:c350fa2f0c19 1118 //set green bits
ivanyohuno 0:c350fa2f0c19 1119 spi.write(g1_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1120 spi.write(g1_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1121 spi.write(g1_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1122 spi.write(g1_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1123 spi.write(g1_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1124 spi.write(g1_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1125 spi.write(g1_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1126 spi.write(g1_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1127 //set red bits
ivanyohuno 0:c350fa2f0c19 1128 spi.write(r1_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1129 spi.write(r1_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1130 spi.write(r1_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1131 spi.write(r1_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1132 spi.write(r1_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1133 spi.write(r1_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1134 spi.write(r1_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1135 spi.write(r1_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1136 //set blue bits
ivanyohuno 0:c350fa2f0c19 1137 spi.write(b1_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1138 spi.write(b1_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1139 spi.write(b1_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1140 spi.write(b1_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1141 spi.write(b1_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1142 spi.write(b1_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1143 spi.write(b1_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1144 spi.write(b1_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1145 //room3
ivanyohuno 0:c350fa2f0c19 1146 //LED0
ivanyohuno 0:c350fa2f0c19 1147 //set green bits
ivanyohuno 0:c350fa2f0c19 1148 spi.write(g2_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1149 spi.write(g2_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1150 spi.write(g2_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1151 spi.write(g2_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1152 spi.write(g2_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1153 spi.write(g2_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1154 spi.write(g2_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1155 spi.write(g2_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1156 //set red bits
ivanyohuno 0:c350fa2f0c19 1157 spi.write(r2_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1158 spi.write(r2_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1159 spi.write(r2_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1160 spi.write(r2_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1161 spi.write(r2_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1162 spi.write(r2_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1163 spi.write(r2_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1164 spi.write(r2_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1165 //set blue bits
ivanyohuno 0:c350fa2f0c19 1166 spi.write(b2_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1167 spi.write(b2_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1168 spi.write(b2_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1169 spi.write(b2_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1170 spi.write(b2_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1171 spi.write(b2_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1172 spi.write(b2_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1173 spi.write(b2_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1174 //LED1
ivanyohuno 0:c350fa2f0c19 1175 //set green bits
ivanyohuno 0:c350fa2f0c19 1176 spi.write(g2_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1177 spi.write(g2_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1178 spi.write(g2_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1179 spi.write(g2_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1180 spi.write(g2_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1181 spi.write(g2_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1182 spi.write(g2_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1183 spi.write(g2_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1184 //set red bits
ivanyohuno 0:c350fa2f0c19 1185 spi.write(r2_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1186 spi.write(r2_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1187 spi.write(r2_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1188 spi.write(r2_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1189 spi.write(r2_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1190 spi.write(r2_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1191 spi.write(r2_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1192 spi.write(r2_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1193 //set blue bits
ivanyohuno 0:c350fa2f0c19 1194 spi.write(b2_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1195 spi.write(b2_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1196 spi.write(b2_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1197 spi.write(b2_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1198 spi.write(b2_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1199 spi.write(b2_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1200 spi.write(b2_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1201 spi.write(b2_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1202 //LED2
ivanyohuno 0:c350fa2f0c19 1203 //set green bits
ivanyohuno 0:c350fa2f0c19 1204 spi.write(g2_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1205 spi.write(g2_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1206 spi.write(g2_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1207 spi.write(g2_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1208 spi.write(g2_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1209 spi.write(g2_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1210 spi.write(g2_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1211 spi.write(g2_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1212 //set red bits
ivanyohuno 0:c350fa2f0c19 1213 spi.write(r2_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1214 spi.write(r2_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1215 spi.write(r2_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1216 spi.write(r2_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1217 spi.write(r2_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1218 spi.write(r2_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1219 spi.write(r2_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1220 spi.write(r2_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1221 //set blue bits
ivanyohuno 0:c350fa2f0c19 1222 spi.write(b2_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1223 spi.write(b2_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1224 spi.write(b2_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1225 spi.write(b2_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1226 spi.write(b2_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1227 spi.write(b2_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1228 spi.write(b2_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1229 spi.write(b2_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1230 //LED3
ivanyohuno 0:c350fa2f0c19 1231 //set green bits
ivanyohuno 0:c350fa2f0c19 1232 spi.write(g2_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1233 spi.write(g2_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1234 spi.write(g2_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1235 spi.write(g2_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1236 spi.write(g2_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1237 spi.write(g2_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1238 spi.write(g2_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1239 spi.write(g2_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1240 //set red bits
ivanyohuno 0:c350fa2f0c19 1241 spi.write(r2_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1242 spi.write(r2_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1243 spi.write(r2_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1244 spi.write(r2_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1245 spi.write(r2_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1246 spi.write(r2_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1247 spi.write(r2_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1248 spi.write(r2_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1249 //set blue bits
ivanyohuno 0:c350fa2f0c19 1250 spi.write(b2_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1251 spi.write(b2_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1252 spi.write(b2_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1253 spi.write(b2_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1254 spi.write(b2_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1255 spi.write(b2_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1256 spi.write(b2_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1257 spi.write(b2_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1258 //LED4
ivanyohuno 0:c350fa2f0c19 1259 //set green bits
ivanyohuno 0:c350fa2f0c19 1260 spi.write(g2_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1261 spi.write(g2_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1262 spi.write(g2_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1263 spi.write(g2_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1264 spi.write(g2_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1265 spi.write(g2_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1266 spi.write(g2_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1267 spi.write(g2_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1268 //set red bits
ivanyohuno 0:c350fa2f0c19 1269 spi.write(r2_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1270 spi.write(r2_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1271 spi.write(r2_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1272 spi.write(r2_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1273 spi.write(r2_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1274 spi.write(r2_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1275 spi.write(r2_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1276 spi.write(r2_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1277 //set blue bits
ivanyohuno 0:c350fa2f0c19 1278 spi.write(b2_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1279 spi.write(b2_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1280 spi.write(b2_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1281 spi.write(b2_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1282 spi.write(b2_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1283 spi.write(b2_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1284 spi.write(b2_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1285 spi.write(b2_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1286 //LED5
ivanyohuno 0:c350fa2f0c19 1287 //set green bits
ivanyohuno 0:c350fa2f0c19 1288 spi.write(g2_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1289 spi.write(g2_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1290 spi.write(g2_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1291 spi.write(g2_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1292 spi.write(g2_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1293 spi.write(g2_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1294 spi.write(g2_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1295 spi.write(g2_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1296 //set red bits
ivanyohuno 0:c350fa2f0c19 1297 spi.write(r2_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1298 spi.write(r2_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1299 spi.write(r2_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1300 spi.write(r2_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1301 spi.write(r2_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1302 spi.write(r2_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1303 spi.write(r2_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1304 spi.write(r2_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1305 //set blue bits
ivanyohuno 0:c350fa2f0c19 1306 spi.write(b2_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1307 spi.write(b2_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1308 spi.write(b2_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1309 spi.write(b2_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1310 spi.write(b2_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1311 spi.write(b2_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1312 spi.write(b2_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1313 spi.write(b2_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1314 //LED6
ivanyohuno 0:c350fa2f0c19 1315 //set green bits
ivanyohuno 0:c350fa2f0c19 1316 spi.write(g2_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1317 spi.write(g2_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1318 spi.write(g2_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1319 spi.write(g2_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1320 spi.write(g2_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1321 spi.write(g2_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1322 spi.write(g2_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1323 spi.write(g2_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1324 //set red bits
ivanyohuno 0:c350fa2f0c19 1325 spi.write(r2_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1326 spi.write(r2_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1327 spi.write(r2_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1328 spi.write(r2_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1329 spi.write(r2_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1330 spi.write(r2_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1331 spi.write(r2_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1332 spi.write(r2_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1333 //set blue bits
ivanyohuno 0:c350fa2f0c19 1334 spi.write(b2_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1335 spi.write(b2_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1336 spi.write(b2_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1337 spi.write(b2_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1338 spi.write(b2_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1339 spi.write(b2_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1340 spi.write(b2_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1341 spi.write(b2_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1342 //LED7
ivanyohuno 0:c350fa2f0c19 1343 //set green bits
ivanyohuno 0:c350fa2f0c19 1344 spi.write(g2_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1345 spi.write(g2_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1346 spi.write(g2_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1347 spi.write(g2_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1348 spi.write(g2_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1349 spi.write(g2_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1350 spi.write(g2_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1351 spi.write(g2_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1352 //set red bits
ivanyohuno 0:c350fa2f0c19 1353 spi.write(r2_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1354 spi.write(r2_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1355 spi.write(r2_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1356 spi.write(r2_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1357 spi.write(r2_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1358 spi.write(r2_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1359 spi.write(r2_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1360 spi.write(r2_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1361 //set blue bits
ivanyohuno 0:c350fa2f0c19 1362 spi.write(b2_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1363 spi.write(b2_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1364 spi.write(b2_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1365 spi.write(b2_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1366 spi.write(b2_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1367 spi.write(b2_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1368 spi.write(b2_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1369 spi.write(b2_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1370 //room 4
ivanyohuno 0:c350fa2f0c19 1371 //LED0
ivanyohuno 0:c350fa2f0c19 1372 //set green bits
ivanyohuno 0:c350fa2f0c19 1373 spi.write(g3_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1374 spi.write(g3_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1375 spi.write(g3_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1376 spi.write(g3_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1377 spi.write(g3_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1378 spi.write(g3_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1379 spi.write(g3_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1380 spi.write(g3_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1381 //set red bits
ivanyohuno 0:c350fa2f0c19 1382 spi.write(r3_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1383 spi.write(r3_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1384 spi.write(r3_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1385 spi.write(r3_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1386 spi.write(r3_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1387 spi.write(r3_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1388 spi.write(r3_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1389 spi.write(r3_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1390 //set blue bits
ivanyohuno 0:c350fa2f0c19 1391 spi.write(b3_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1392 spi.write(b3_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1393 spi.write(b3_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1394 spi.write(b3_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1395 spi.write(b3_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1396 spi.write(b3_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1397 spi.write(b3_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1398 spi.write(b3_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1399 //LED1
ivanyohuno 0:c350fa2f0c19 1400 //set green bits
ivanyohuno 0:c350fa2f0c19 1401 spi.write(g3_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1402 spi.write(g3_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1403 spi.write(g3_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1404 spi.write(g3_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1405 spi.write(g3_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1406 spi.write(g3_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1407 spi.write(g3_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1408 spi.write(g3_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1409 //set red bits
ivanyohuno 0:c350fa2f0c19 1410 spi.write(r3_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1411 spi.write(r3_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1412 spi.write(r3_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1413 spi.write(r3_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1414 spi.write(r3_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1415 spi.write(r3_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1416 spi.write(r3_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1417 spi.write(r3_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1418 //set blue bits
ivanyohuno 0:c350fa2f0c19 1419 spi.write(b3_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1420 spi.write(b3_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1421 spi.write(b3_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1422 spi.write(b3_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1423 spi.write(b3_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1424 spi.write(b3_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1425 spi.write(b3_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1426 spi.write(b3_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1427 //LED2
ivanyohuno 0:c350fa2f0c19 1428 //set green bits
ivanyohuno 0:c350fa2f0c19 1429 spi.write(g3_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1430 spi.write(g3_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1431 spi.write(g3_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1432 spi.write(g3_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1433 spi.write(g3_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1434 spi.write(g3_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1435 spi.write(g3_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1436 spi.write(g3_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1437 //set red bits
ivanyohuno 0:c350fa2f0c19 1438 spi.write(r3_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1439 spi.write(r3_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1440 spi.write(r3_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1441 spi.write(r3_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1442 spi.write(r3_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1443 spi.write(r3_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1444 spi.write(r3_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1445 spi.write(r3_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1446 //set blue bits
ivanyohuno 0:c350fa2f0c19 1447 spi.write(b3_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1448 spi.write(b3_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1449 spi.write(b3_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1450 spi.write(b3_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1451 spi.write(b3_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1452 spi.write(b3_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1453 spi.write(b3_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1454 spi.write(b3_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1455 //LED3
ivanyohuno 0:c350fa2f0c19 1456 //set green bits
ivanyohuno 0:c350fa2f0c19 1457 spi.write(g3_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1458 spi.write(g3_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1459 spi.write(g3_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1460 spi.write(g3_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1461 spi.write(g3_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1462 spi.write(g3_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1463 spi.write(g3_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1464 spi.write(g3_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1465 //set red bits
ivanyohuno 0:c350fa2f0c19 1466 spi.write(r3_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1467 spi.write(r3_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1468 spi.write(r3_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1469 spi.write(r3_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1470 spi.write(r3_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1471 spi.write(r3_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1472 spi.write(r3_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1473 spi.write(r3_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1474 //set blue bits
ivanyohuno 0:c350fa2f0c19 1475 spi.write(b3_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1476 spi.write(b3_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1477 spi.write(b3_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1478 spi.write(b3_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1479 spi.write(b3_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1480 spi.write(b3_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1481 spi.write(b3_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1482 spi.write(b3_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1483 //LED4
ivanyohuno 0:c350fa2f0c19 1484 //set green bits
ivanyohuno 0:c350fa2f0c19 1485 spi.write(g3_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1486 spi.write(g3_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1487 spi.write(g3_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1488 spi.write(g3_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1489 spi.write(g3_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1490 spi.write(g3_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1491 spi.write(g3_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1492 spi.write(g3_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1493 //set red bits
ivanyohuno 0:c350fa2f0c19 1494 spi.write(r3_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1495 spi.write(r3_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1496 spi.write(r3_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1497 spi.write(r3_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1498 spi.write(r3_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1499 spi.write(r3_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1500 spi.write(r3_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1501 spi.write(r3_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1502 //set blue bits
ivanyohuno 0:c350fa2f0c19 1503 spi.write(b3_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1504 spi.write(b3_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1505 spi.write(b3_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1506 spi.write(b3_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1507 spi.write(b3_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1508 spi.write(b3_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1509 spi.write(b3_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1510 spi.write(b3_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1511 //LED5
ivanyohuno 0:c350fa2f0c19 1512 //set green bits
ivanyohuno 0:c350fa2f0c19 1513 spi.write(g3_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1514 spi.write(g3_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1515 spi.write(g3_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1516 spi.write(g3_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1517 spi.write(g3_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1518 spi.write(g3_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1519 spi.write(g3_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1520 spi.write(g3_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1521 //set red bits
ivanyohuno 0:c350fa2f0c19 1522 spi.write(r3_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1523 spi.write(r3_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1524 spi.write(r3_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1525 spi.write(r3_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1526 spi.write(r3_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1527 spi.write(r3_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1528 spi.write(r3_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1529 spi.write(r3_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1530 //set blue bits
ivanyohuno 0:c350fa2f0c19 1531 spi.write(b3_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1532 spi.write(b3_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1533 spi.write(b3_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1534 spi.write(b3_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1535 spi.write(b3_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1536 spi.write(b3_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1537 spi.write(b3_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1538 spi.write(b3_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1539 //LED6
ivanyohuno 0:c350fa2f0c19 1540 //set green bits
ivanyohuno 0:c350fa2f0c19 1541 spi.write(g3_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1542 spi.write(g3_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1543 spi.write(g3_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1544 spi.write(g3_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1545 spi.write(g3_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1546 spi.write(g3_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1547 spi.write(g3_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1548 spi.write(g3_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1549 //set red bits
ivanyohuno 0:c350fa2f0c19 1550 spi.write(r3_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1551 spi.write(r3_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1552 spi.write(r3_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1553 spi.write(r3_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1554 spi.write(r3_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1555 spi.write(r3_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1556 spi.write(r3_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1557 spi.write(r3_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1558 //set blue bits
ivanyohuno 0:c350fa2f0c19 1559 spi.write(b3_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1560 spi.write(b3_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1561 spi.write(b3_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1562 spi.write(b3_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1563 spi.write(b3_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1564 spi.write(b3_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1565 spi.write(b3_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1566 spi.write(b3_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1567 //LED7
ivanyohuno 0:c350fa2f0c19 1568 //set green bits
ivanyohuno 0:c350fa2f0c19 1569 spi.write(g3_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1570 spi.write(g3_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1571 spi.write(g3_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1572 spi.write(g3_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1573 spi.write(g3_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1574 spi.write(g3_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1575 spi.write(g3_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1576 spi.write(g3_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1577 //set red bits
ivanyohuno 0:c350fa2f0c19 1578 spi.write(r3_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1579 spi.write(r3_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1580 spi.write(r3_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1581 spi.write(r3_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1582 spi.write(r3_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1583 spi.write(r3_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1584 spi.write(r3_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1585 spi.write(r3_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1586 //set blue bits
ivanyohuno 0:c350fa2f0c19 1587 spi.write(b3_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1588 spi.write(b3_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1589 spi.write(b3_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1590 spi.write(b3_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1591 spi.write(b3_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1592 spi.write(b3_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1593 spi.write(b3_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1594 spi.write(b3_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1595 //wait for latch
ivanyohuno 0:c350fa2f0c19 1596 wait_us(60);
ivanyohuno 0:c350fa2f0c19 1597 }
ivanyohuno 0:c350fa2f0c19 1598
ivanyohuno 1:42b43fa7362f 1599 void setRGBFloor_2(int room1[8][3], int room2[8][3]){
ivanyohuno 0:c350fa2f0c19 1600 //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary
ivanyohuno 0:c350fa2f0c19 1601 //room1
ivanyohuno 0:c350fa2f0c19 1602 int r00_array[8]; //LED0
ivanyohuno 0:c350fa2f0c19 1603 int g00_array[8];
ivanyohuno 0:c350fa2f0c19 1604 int b00_array[8];
ivanyohuno 1:42b43fa7362f 1605 memcpy(r00_array, decimalToBinary(room1[0][0]), sizeof(r00_array));
ivanyohuno 1:42b43fa7362f 1606 memcpy(g00_array, decimalToBinary(room1[0][1]), sizeof(g00_array));
ivanyohuno 1:42b43fa7362f 1607 memcpy(b00_array, decimalToBinary(room1[0][2]), sizeof(b00_array));
ivanyohuno 0:c350fa2f0c19 1608 int r01_array[8]; //LED1
ivanyohuno 0:c350fa2f0c19 1609 int g01_array[8];
ivanyohuno 0:c350fa2f0c19 1610 int b01_array[8];
ivanyohuno 1:42b43fa7362f 1611 memcpy(r01_array, decimalToBinary(room1[1][0]), sizeof(r01_array));
ivanyohuno 1:42b43fa7362f 1612 memcpy(g01_array, decimalToBinary(room1[1][1]), sizeof(g01_array));
ivanyohuno 1:42b43fa7362f 1613 memcpy(b01_array, decimalToBinary(room1[1][2]), sizeof(b01_array));
ivanyohuno 0:c350fa2f0c19 1614 int r02_array[8]; //LED2
ivanyohuno 0:c350fa2f0c19 1615 int g02_array[8];
ivanyohuno 0:c350fa2f0c19 1616 int b02_array[8];
ivanyohuno 1:42b43fa7362f 1617 memcpy(r02_array, decimalToBinary(room1[2][0]), sizeof(r02_array));
ivanyohuno 1:42b43fa7362f 1618 memcpy(g02_array, decimalToBinary(room1[2][1]), sizeof(g02_array));
ivanyohuno 1:42b43fa7362f 1619 memcpy(b02_array, decimalToBinary(room1[2][2]), sizeof(b02_array));
ivanyohuno 0:c350fa2f0c19 1620 int r03_array[8]; //LED3
ivanyohuno 0:c350fa2f0c19 1621 int g03_array[8];
ivanyohuno 0:c350fa2f0c19 1622 int b03_array[8];
ivanyohuno 1:42b43fa7362f 1623 memcpy(r03_array, decimalToBinary(room1[3][0]), sizeof(r03_array));
ivanyohuno 1:42b43fa7362f 1624 memcpy(g03_array, decimalToBinary(room1[3][1]), sizeof(g03_array));
ivanyohuno 1:42b43fa7362f 1625 memcpy(b03_array, decimalToBinary(room1[3][2]), sizeof(b03_array));
ivanyohuno 0:c350fa2f0c19 1626 int r04_array[8]; //LED4
ivanyohuno 0:c350fa2f0c19 1627 int g04_array[8];
ivanyohuno 0:c350fa2f0c19 1628 int b04_array[8];
ivanyohuno 1:42b43fa7362f 1629 memcpy(r04_array, decimalToBinary(room1[4][0]), sizeof(r04_array));
ivanyohuno 1:42b43fa7362f 1630 memcpy(g04_array, decimalToBinary(room1[4][1]), sizeof(g04_array));
ivanyohuno 1:42b43fa7362f 1631 memcpy(b04_array, decimalToBinary(room1[4][2]), sizeof(b04_array));
ivanyohuno 0:c350fa2f0c19 1632 int r05_array[8]; //LED5
ivanyohuno 0:c350fa2f0c19 1633 int g05_array[8];
ivanyohuno 0:c350fa2f0c19 1634 int b05_array[8];
ivanyohuno 1:42b43fa7362f 1635 memcpy(r05_array, decimalToBinary(room1[5][0]), sizeof(r05_array));
ivanyohuno 1:42b43fa7362f 1636 memcpy(g05_array, decimalToBinary(room1[5][1]), sizeof(g05_array));
ivanyohuno 1:42b43fa7362f 1637 memcpy(b05_array, decimalToBinary(room1[5][2]), sizeof(b05_array));
ivanyohuno 0:c350fa2f0c19 1638 int r06_array[8]; //LED6
ivanyohuno 0:c350fa2f0c19 1639 int g06_array[8];
ivanyohuno 0:c350fa2f0c19 1640 int b06_array[8];
ivanyohuno 1:42b43fa7362f 1641 memcpy(r06_array, decimalToBinary(room1[6][0]), sizeof(r06_array));
ivanyohuno 1:42b43fa7362f 1642 memcpy(g06_array, decimalToBinary(room1[6][1]), sizeof(g06_array));
ivanyohuno 1:42b43fa7362f 1643 memcpy(b06_array, decimalToBinary(room1[6][2]), sizeof(b06_array));
ivanyohuno 0:c350fa2f0c19 1644 int r07_array[8]; //LED7
ivanyohuno 0:c350fa2f0c19 1645 int g07_array[8];
ivanyohuno 0:c350fa2f0c19 1646 int b07_array[8];
ivanyohuno 1:42b43fa7362f 1647 memcpy(r07_array, decimalToBinary(room1[7][0]), sizeof(r07_array));
ivanyohuno 1:42b43fa7362f 1648 memcpy(g07_array, decimalToBinary(room1[7][1]), sizeof(g07_array));
ivanyohuno 1:42b43fa7362f 1649 memcpy(b07_array, decimalToBinary(room1[7][2]), sizeof(b07_array));
ivanyohuno 0:c350fa2f0c19 1650
ivanyohuno 0:c350fa2f0c19 1651 //room2
ivanyohuno 0:c350fa2f0c19 1652 int r10_array[8]; //LED0
ivanyohuno 0:c350fa2f0c19 1653 int g10_array[8];
ivanyohuno 0:c350fa2f0c19 1654 int b10_array[8];
ivanyohuno 1:42b43fa7362f 1655 memcpy(r10_array, decimalToBinary(room2[0][0]), sizeof(r10_array));
ivanyohuno 1:42b43fa7362f 1656 memcpy(g10_array, decimalToBinary(room2[0][1]), sizeof(g10_array));
ivanyohuno 1:42b43fa7362f 1657 memcpy(b10_array, decimalToBinary(room2[0][2]), sizeof(b10_array));
ivanyohuno 0:c350fa2f0c19 1658 int r11_array[8]; //LED1
ivanyohuno 0:c350fa2f0c19 1659 int g11_array[8];
ivanyohuno 0:c350fa2f0c19 1660 int b11_array[8];
ivanyohuno 1:42b43fa7362f 1661 memcpy(r11_array, decimalToBinary(room2[1][0]), sizeof(r11_array));
ivanyohuno 1:42b43fa7362f 1662 memcpy(g11_array, decimalToBinary(room2[1][1]), sizeof(g11_array));
ivanyohuno 1:42b43fa7362f 1663 memcpy(b11_array, decimalToBinary(room2[1][2]), sizeof(b11_array));
ivanyohuno 0:c350fa2f0c19 1664 int r12_array[8]; //LED2
ivanyohuno 0:c350fa2f0c19 1665 int g12_array[8];
ivanyohuno 0:c350fa2f0c19 1666 int b12_array[8];
ivanyohuno 1:42b43fa7362f 1667 memcpy(r12_array, decimalToBinary(room2[2][0]), sizeof(r12_array));
ivanyohuno 1:42b43fa7362f 1668 memcpy(g12_array, decimalToBinary(room2[2][1]), sizeof(g12_array));
ivanyohuno 1:42b43fa7362f 1669 memcpy(b12_array, decimalToBinary(room2[2][2]), sizeof(b12_array));
ivanyohuno 0:c350fa2f0c19 1670 int r13_array[8]; //LED3
ivanyohuno 0:c350fa2f0c19 1671 int g13_array[8];
ivanyohuno 0:c350fa2f0c19 1672 int b13_array[8];
ivanyohuno 1:42b43fa7362f 1673 memcpy(r13_array, decimalToBinary(room2[3][0]), sizeof(r13_array));
ivanyohuno 1:42b43fa7362f 1674 memcpy(g13_array, decimalToBinary(room2[3][1]), sizeof(g13_array));
ivanyohuno 1:42b43fa7362f 1675 memcpy(b13_array, decimalToBinary(room2[3][2]), sizeof(b13_array));
ivanyohuno 0:c350fa2f0c19 1676 int r14_array[8]; //LED4
ivanyohuno 0:c350fa2f0c19 1677 int g14_array[8];
ivanyohuno 0:c350fa2f0c19 1678 int b14_array[8];
ivanyohuno 1:42b43fa7362f 1679 memcpy(r14_array, decimalToBinary(room2[4][0]), sizeof(r14_array));
ivanyohuno 1:42b43fa7362f 1680 memcpy(g14_array, decimalToBinary(room2[4][1]), sizeof(g14_array));
ivanyohuno 1:42b43fa7362f 1681 memcpy(b14_array, decimalToBinary(room2[4][2]), sizeof(b14_array));
ivanyohuno 0:c350fa2f0c19 1682 int r15_array[8]; //LED5
ivanyohuno 0:c350fa2f0c19 1683 int g15_array[8];
ivanyohuno 0:c350fa2f0c19 1684 int b15_array[8];
ivanyohuno 1:42b43fa7362f 1685 memcpy(r15_array, decimalToBinary(room2[5][0]), sizeof(r15_array));
ivanyohuno 1:42b43fa7362f 1686 memcpy(g15_array, decimalToBinary(room2[5][1]), sizeof(g15_array));
ivanyohuno 1:42b43fa7362f 1687 memcpy(b15_array, decimalToBinary(room2[5][2]), sizeof(b15_array));
ivanyohuno 0:c350fa2f0c19 1688 int r16_array[8]; //LED6
ivanyohuno 0:c350fa2f0c19 1689 int g16_array[8];
ivanyohuno 0:c350fa2f0c19 1690 int b16_array[8];
ivanyohuno 1:42b43fa7362f 1691 memcpy(r16_array, decimalToBinary(room2[6][0]), sizeof(r16_array));
ivanyohuno 1:42b43fa7362f 1692 memcpy(g16_array, decimalToBinary(room2[6][1]), sizeof(g16_array));
ivanyohuno 1:42b43fa7362f 1693 memcpy(b16_array, decimalToBinary(room2[6][2]), sizeof(b16_array));
ivanyohuno 0:c350fa2f0c19 1694 int r17_array[8]; //LED7
ivanyohuno 0:c350fa2f0c19 1695 int g17_array[8];
ivanyohuno 0:c350fa2f0c19 1696 int b17_array[8];
ivanyohuno 1:42b43fa7362f 1697 memcpy(r17_array, decimalToBinary(room2[7][0]), sizeof(r17_array));
ivanyohuno 1:42b43fa7362f 1698 memcpy(g17_array, decimalToBinary(room2[7][1]), sizeof(g17_array));
ivanyohuno 1:42b43fa7362f 1699 memcpy(b17_array, decimalToBinary(room2[7][2]), sizeof(b17_array));
ivanyohuno 0:c350fa2f0c19 1700
ivanyohuno 0:c350fa2f0c19 1701 //send commands to LED Driver
ivanyohuno 0:c350fa2f0c19 1702 //initialize SPI
ivanyohuno 0:c350fa2f0c19 1703 spi_init();
ivanyohuno 0:c350fa2f0c19 1704 //room1
ivanyohuno 0:c350fa2f0c19 1705 //LED0
ivanyohuno 0:c350fa2f0c19 1706 //set green bits
ivanyohuno 0:c350fa2f0c19 1707 spi.write(g00_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1708 spi.write(g00_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1709 spi.write(g00_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1710 spi.write(g00_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1711 spi.write(g00_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1712 spi.write(g00_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1713 spi.write(g00_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1714 spi.write(g00_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1715 //set red bits
ivanyohuno 0:c350fa2f0c19 1716 spi.write(r00_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1717 spi.write(r00_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1718 spi.write(r00_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1719 spi.write(r00_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1720 spi.write(r00_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1721 spi.write(r00_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1722 spi.write(r00_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1723 spi.write(r00_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1724 //set blue bits
ivanyohuno 0:c350fa2f0c19 1725 spi.write(b00_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1726 spi.write(b00_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1727 spi.write(b00_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1728 spi.write(b00_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1729 spi.write(b00_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1730 spi.write(b00_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1731 spi.write(b00_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1732 spi.write(b00_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1733 //LED1
ivanyohuno 0:c350fa2f0c19 1734 //set green bits
ivanyohuno 0:c350fa2f0c19 1735 spi.write(g01_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1736 spi.write(g01_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1737 spi.write(g01_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1738 spi.write(g01_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1739 spi.write(g01_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1740 spi.write(g01_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1741 spi.write(g01_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1742 spi.write(g01_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1743 //set red bits
ivanyohuno 0:c350fa2f0c19 1744 spi.write(r01_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1745 spi.write(r01_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1746 spi.write(r01_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1747 spi.write(r01_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1748 spi.write(r01_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1749 spi.write(r01_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1750 spi.write(r01_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1751 spi.write(r01_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1752 //set blue bits
ivanyohuno 0:c350fa2f0c19 1753 spi.write(b01_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1754 spi.write(b01_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1755 spi.write(b01_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1756 spi.write(b01_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1757 spi.write(b01_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1758 spi.write(b01_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1759 spi.write(b01_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1760 spi.write(b01_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1761 //LED2
ivanyohuno 0:c350fa2f0c19 1762 //set green bits
ivanyohuno 0:c350fa2f0c19 1763 spi.write(g02_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1764 spi.write(g02_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1765 spi.write(g02_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1766 spi.write(g02_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1767 spi.write(g02_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1768 spi.write(g02_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1769 spi.write(g02_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1770 spi.write(g02_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1771 //set red bits
ivanyohuno 0:c350fa2f0c19 1772 spi.write(r02_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1773 spi.write(r02_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1774 spi.write(r02_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1775 spi.write(r02_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1776 spi.write(r02_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1777 spi.write(r02_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1778 spi.write(r02_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1779 spi.write(r02_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1780 //set blue bits
ivanyohuno 0:c350fa2f0c19 1781 spi.write(b02_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1782 spi.write(b02_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1783 spi.write(b02_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1784 spi.write(b02_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1785 spi.write(b02_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1786 spi.write(b02_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1787 spi.write(b02_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1788 spi.write(b02_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1789 //LED3
ivanyohuno 0:c350fa2f0c19 1790 //set green bits
ivanyohuno 0:c350fa2f0c19 1791 spi.write(g03_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1792 spi.write(g03_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1793 spi.write(g03_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1794 spi.write(g03_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1795 spi.write(g03_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1796 spi.write(g03_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1797 spi.write(g03_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1798 spi.write(g03_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1799 //set red bits
ivanyohuno 0:c350fa2f0c19 1800 spi.write(r03_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1801 spi.write(r03_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1802 spi.write(r03_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1803 spi.write(r03_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1804 spi.write(r03_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1805 spi.write(r03_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1806 spi.write(r03_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1807 spi.write(r03_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1808 //set blue bits
ivanyohuno 0:c350fa2f0c19 1809 spi.write(b03_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1810 spi.write(b03_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1811 spi.write(b03_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1812 spi.write(b03_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1813 spi.write(b03_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1814 spi.write(b03_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1815 spi.write(b03_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1816 spi.write(b03_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1817 //LED4
ivanyohuno 0:c350fa2f0c19 1818 //set green bits
ivanyohuno 0:c350fa2f0c19 1819 spi.write(g04_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1820 spi.write(g04_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1821 spi.write(g04_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1822 spi.write(g04_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1823 spi.write(g04_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1824 spi.write(g04_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1825 spi.write(g04_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1826 spi.write(g04_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1827 //set red bits
ivanyohuno 0:c350fa2f0c19 1828 spi.write(r04_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1829 spi.write(r04_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1830 spi.write(r04_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1831 spi.write(r04_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1832 spi.write(r04_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1833 spi.write(r04_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1834 spi.write(r04_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1835 spi.write(r04_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1836 //set blue bits
ivanyohuno 0:c350fa2f0c19 1837 spi.write(b04_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1838 spi.write(b04_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1839 spi.write(b04_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1840 spi.write(b04_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1841 spi.write(b04_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1842 spi.write(b04_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1843 spi.write(b04_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1844 spi.write(b04_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1845 //LED5
ivanyohuno 0:c350fa2f0c19 1846 //set green bits
ivanyohuno 0:c350fa2f0c19 1847 spi.write(g05_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1848 spi.write(g05_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1849 spi.write(g05_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1850 spi.write(g05_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1851 spi.write(g05_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1852 spi.write(g05_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1853 spi.write(g05_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1854 spi.write(g05_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1855 //set red bits
ivanyohuno 0:c350fa2f0c19 1856 spi.write(r05_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1857 spi.write(r05_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1858 spi.write(r05_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1859 spi.write(r05_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1860 spi.write(r05_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1861 spi.write(r05_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1862 spi.write(r05_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1863 spi.write(r05_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1864 //set blue bits
ivanyohuno 0:c350fa2f0c19 1865 spi.write(b05_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1866 spi.write(b05_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1867 spi.write(b05_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1868 spi.write(b05_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1869 spi.write(b05_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1870 spi.write(b05_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1871 spi.write(b05_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1872 spi.write(b05_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1873 //LED6
ivanyohuno 0:c350fa2f0c19 1874 //set green bits
ivanyohuno 0:c350fa2f0c19 1875 spi.write(g06_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1876 spi.write(g06_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1877 spi.write(g06_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1878 spi.write(g06_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1879 spi.write(g06_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1880 spi.write(g06_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1881 spi.write(g06_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1882 spi.write(g06_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1883 //set red bits
ivanyohuno 0:c350fa2f0c19 1884 spi.write(r06_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1885 spi.write(r06_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1886 spi.write(r06_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1887 spi.write(r06_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1888 spi.write(r06_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1889 spi.write(r06_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1890 spi.write(r06_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1891 spi.write(r06_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1892 //set blue bits
ivanyohuno 0:c350fa2f0c19 1893 spi.write(b06_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1894 spi.write(b06_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1895 spi.write(b06_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1896 spi.write(b06_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1897 spi.write(b06_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1898 spi.write(b06_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1899 spi.write(b06_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1900 spi.write(b06_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1901 //LED7
ivanyohuno 0:c350fa2f0c19 1902 //set green bits
ivanyohuno 0:c350fa2f0c19 1903 spi.write(g07_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1904 spi.write(g07_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1905 spi.write(g07_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1906 spi.write(g07_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1907 spi.write(g07_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1908 spi.write(g07_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1909 spi.write(g07_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1910 spi.write(g07_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1911 //set red bits
ivanyohuno 0:c350fa2f0c19 1912 spi.write(r07_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1913 spi.write(r07_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1914 spi.write(r07_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1915 spi.write(r07_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1916 spi.write(r07_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1917 spi.write(r07_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1918 spi.write(r07_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1919 spi.write(r07_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1920 //set blue bits
ivanyohuno 0:c350fa2f0c19 1921 spi.write(b07_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1922 spi.write(b07_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1923 spi.write(b07_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1924 spi.write(b07_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1925 spi.write(b07_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1926 spi.write(b07_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1927 spi.write(b07_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1928 spi.write(b07_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1929 //room2
ivanyohuno 0:c350fa2f0c19 1930 //LED0
ivanyohuno 0:c350fa2f0c19 1931 //set green bits
ivanyohuno 0:c350fa2f0c19 1932 spi.write(g10_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1933 spi.write(g10_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1934 spi.write(g10_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1935 spi.write(g10_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1936 spi.write(g10_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1937 spi.write(g10_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1938 spi.write(g10_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1939 spi.write(g10_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1940 //set red bits
ivanyohuno 0:c350fa2f0c19 1941 spi.write(r10_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1942 spi.write(r10_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1943 spi.write(r10_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1944 spi.write(r10_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1945 spi.write(r10_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1946 spi.write(r10_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1947 spi.write(r10_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1948 spi.write(r10_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1949 //set blue bits
ivanyohuno 0:c350fa2f0c19 1950 spi.write(b10_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1951 spi.write(b10_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1952 spi.write(b10_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1953 spi.write(b10_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1954 spi.write(b10_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1955 spi.write(b10_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1956 spi.write(b10_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1957 spi.write(b10_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1958 //LED1
ivanyohuno 0:c350fa2f0c19 1959 //set green bits
ivanyohuno 0:c350fa2f0c19 1960 spi.write(g11_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1961 spi.write(g11_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1962 spi.write(g11_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1963 spi.write(g11_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1964 spi.write(g11_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1965 spi.write(g11_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1966 spi.write(g11_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1967 spi.write(g11_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1968 //set red bits
ivanyohuno 0:c350fa2f0c19 1969 spi.write(r11_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1970 spi.write(r11_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1971 spi.write(r11_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 1972 spi.write(r11_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 1973 spi.write(r11_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 1974 spi.write(r11_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 1975 spi.write(r11_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 1976 spi.write(r11_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 1977 //set blue bits
ivanyohuno 0:c350fa2f0c19 1978 spi.write(b11_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 1979 spi.write(b11_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 1980 spi.write(b11_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 1981 spi.write(b11_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 1982 spi.write(b11_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 1983 spi.write(b11_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 1984 spi.write(b11_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 1985 spi.write(b11_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 1986 //LED2
ivanyohuno 0:c350fa2f0c19 1987 //set green bits
ivanyohuno 0:c350fa2f0c19 1988 spi.write(g12_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 1989 spi.write(g12_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 1990 spi.write(g12_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 1991 spi.write(g12_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 1992 spi.write(g12_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 1993 spi.write(g12_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 1994 spi.write(g12_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 1995 spi.write(g12_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 1996 //set red bits
ivanyohuno 0:c350fa2f0c19 1997 spi.write(r12_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 1998 spi.write(r12_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 1999 spi.write(r12_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 2000 spi.write(r12_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 2001 spi.write(r12_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 2002 spi.write(r12_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 2003 spi.write(r12_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 2004 spi.write(r12_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2005 //set blue bits
ivanyohuno 0:c350fa2f0c19 2006 spi.write(b12_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 2007 spi.write(b12_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 2008 spi.write(b12_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 2009 spi.write(b12_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 2010 spi.write(b12_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 2011 spi.write(b12_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 2012 spi.write(b12_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 2013 spi.write(b12_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2014 //LED3
ivanyohuno 0:c350fa2f0c19 2015 //set green bits
ivanyohuno 0:c350fa2f0c19 2016 spi.write(g13_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 2017 spi.write(g13_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 2018 spi.write(g13_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 2019 spi.write(g13_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 2020 spi.write(g13_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 2021 spi.write(g13_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 2022 spi.write(g13_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 2023 spi.write(g13_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2024 //set red bits
ivanyohuno 0:c350fa2f0c19 2025 spi.write(r13_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 2026 spi.write(r13_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 2027 spi.write(r13_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 2028 spi.write(r13_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 2029 spi.write(r13_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 2030 spi.write(r13_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 2031 spi.write(r13_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 2032 spi.write(r13_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2033 //set blue bits
ivanyohuno 0:c350fa2f0c19 2034 spi.write(b13_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 2035 spi.write(b13_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 2036 spi.write(b13_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 2037 spi.write(b13_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 2038 spi.write(b13_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 2039 spi.write(b13_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 2040 spi.write(b13_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 2041 spi.write(b13_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2042 //LED4
ivanyohuno 0:c350fa2f0c19 2043 //set green bits
ivanyohuno 0:c350fa2f0c19 2044 spi.write(g14_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 2045 spi.write(g14_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 2046 spi.write(g14_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 2047 spi.write(g14_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 2048 spi.write(g14_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 2049 spi.write(g14_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 2050 spi.write(g14_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 2051 spi.write(g14_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2052 //set red bits
ivanyohuno 0:c350fa2f0c19 2053 spi.write(r14_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 2054 spi.write(r14_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 2055 spi.write(r14_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 2056 spi.write(r14_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 2057 spi.write(r14_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 2058 spi.write(r14_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 2059 spi.write(r14_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 2060 spi.write(r14_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2061 //set blue bits
ivanyohuno 0:c350fa2f0c19 2062 spi.write(b14_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 2063 spi.write(b14_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 2064 spi.write(b14_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 2065 spi.write(b14_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 2066 spi.write(b14_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 2067 spi.write(b14_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 2068 spi.write(b14_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 2069 spi.write(b14_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2070 //LED5
ivanyohuno 0:c350fa2f0c19 2071 //set green bits
ivanyohuno 0:c350fa2f0c19 2072 spi.write(g15_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 2073 spi.write(g15_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 2074 spi.write(g15_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 2075 spi.write(g15_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 2076 spi.write(g15_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 2077 spi.write(g15_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 2078 spi.write(g15_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 2079 spi.write(g15_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2080 //set red bits
ivanyohuno 0:c350fa2f0c19 2081 spi.write(r15_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 2082 spi.write(r15_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 2083 spi.write(r15_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 2084 spi.write(r15_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 2085 spi.write(r15_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 2086 spi.write(r15_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 2087 spi.write(r15_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 2088 spi.write(r15_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2089 //set blue bits
ivanyohuno 0:c350fa2f0c19 2090 spi.write(b15_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 2091 spi.write(b15_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 2092 spi.write(b15_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 2093 spi.write(b15_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 2094 spi.write(b15_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 2095 spi.write(b15_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 2096 spi.write(b15_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 2097 spi.write(b15_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2098 //LED6
ivanyohuno 0:c350fa2f0c19 2099 //set green bits
ivanyohuno 0:c350fa2f0c19 2100 spi.write(g16_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 2101 spi.write(g16_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 2102 spi.write(g16_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 2103 spi.write(g16_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 2104 spi.write(g16_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 2105 spi.write(g16_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 2106 spi.write(g16_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 2107 spi.write(g16_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2108 //set red bits
ivanyohuno 0:c350fa2f0c19 2109 spi.write(r16_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 2110 spi.write(r16_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 2111 spi.write(r16_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 2112 spi.write(r16_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 2113 spi.write(r16_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 2114 spi.write(r16_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 2115 spi.write(r16_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 2116 spi.write(r16_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2117 //set blue bits
ivanyohuno 0:c350fa2f0c19 2118 spi.write(b16_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 2119 spi.write(b16_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 2120 spi.write(b16_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 2121 spi.write(b16_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 2122 spi.write(b16_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 2123 spi.write(b16_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 2124 spi.write(b16_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 2125 spi.write(b16_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2126 //LED7
ivanyohuno 0:c350fa2f0c19 2127 //set green bits
ivanyohuno 0:c350fa2f0c19 2128 spi.write(g17_array[7]); //set g7 bit
ivanyohuno 0:c350fa2f0c19 2129 spi.write(g17_array[6]); //set g6 bit
ivanyohuno 0:c350fa2f0c19 2130 spi.write(g17_array[5]); //set g5 bit
ivanyohuno 0:c350fa2f0c19 2131 spi.write(g17_array[4]); //set g4 bit
ivanyohuno 0:c350fa2f0c19 2132 spi.write(g17_array[3]); //set g3 bit
ivanyohuno 0:c350fa2f0c19 2133 spi.write(g17_array[2]); //set g2 bit
ivanyohuno 0:c350fa2f0c19 2134 spi.write(g17_array[1]); //set g1 bit
ivanyohuno 0:c350fa2f0c19 2135 spi.write(g17_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2136 //set red bits
ivanyohuno 0:c350fa2f0c19 2137 spi.write(r17_array[7]);//set r7 bit
ivanyohuno 0:c350fa2f0c19 2138 spi.write(r17_array[6]); //set r6 bit
ivanyohuno 0:c350fa2f0c19 2139 spi.write(r17_array[5]); //set r5 bit
ivanyohuno 0:c350fa2f0c19 2140 spi.write(r17_array[4]); //set r4 bit
ivanyohuno 0:c350fa2f0c19 2141 spi.write(r17_array[3]); //set r3 bit
ivanyohuno 0:c350fa2f0c19 2142 spi.write(r17_array[2]); //set r2 bit
ivanyohuno 0:c350fa2f0c19 2143 spi.write(r17_array[1]); //set r1 bit
ivanyohuno 0:c350fa2f0c19 2144 spi.write(r17_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2145 //set blue bits
ivanyohuno 0:c350fa2f0c19 2146 spi.write(b17_array[7]); //set b7 bit
ivanyohuno 0:c350fa2f0c19 2147 spi.write(b17_array[6]); //set b6 bit
ivanyohuno 0:c350fa2f0c19 2148 spi.write(b17_array[5]); //set b5 bit
ivanyohuno 0:c350fa2f0c19 2149 spi.write(b17_array[4]); //set b4 bit
ivanyohuno 0:c350fa2f0c19 2150 spi.write(b17_array[3]); //set b3 bit
ivanyohuno 0:c350fa2f0c19 2151 spi.write(b17_array[2]); //set b2 bit
ivanyohuno 0:c350fa2f0c19 2152 spi.write(b17_array[1]); //set b1 bit
ivanyohuno 0:c350fa2f0c19 2153 spi.write(b17_array[0]); //set b0 bit
ivanyohuno 1:42b43fa7362f 2154
ivanyohuno 1:42b43fa7362f 2155 //wait for latch
ivanyohuno 1:42b43fa7362f 2156 wait_us(60);
ivanyohuno 1:42b43fa7362f 2157 }
ivanyohuno 1:42b43fa7362f 2158
ivanyohuno 1:42b43fa7362f 2159 void setRGBFloor_2(int room3[8][3], int room4[8][3]){
ivanyohuno 1:42b43fa7362f 2160 //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary
ivanyohuno 1:42b43fa7362f 2161 //room2
ivanyohuno 1:42b43fa7362f 2162 int r00_array[8]; //LED0
ivanyohuno 1:42b43fa7362f 2163 int g00_array[8];
ivanyohuno 1:42b43fa7362f 2164 int b00_array[8];
ivanyohuno 1:42b43fa7362f 2165 memcpy(r00_array, decimalToBinary(room3[0][0]), sizeof(r00_array));
ivanyohuno 1:42b43fa7362f 2166 memcpy(g00_array, decimalToBinary(room3[0][1]), sizeof(g00_array));
ivanyohuno 1:42b43fa7362f 2167 memcpy(b00_array, decimalToBinary(room3[0][2]), sizeof(b00_array));
ivanyohuno 1:42b43fa7362f 2168 int r01_array[8]; //LED1
ivanyohuno 1:42b43fa7362f 2169 int g01_array[8];
ivanyohuno 1:42b43fa7362f 2170 int b01_array[8];
ivanyohuno 1:42b43fa7362f 2171 memcpy(r01_array, decimalToBinary(room3[1][0]), sizeof(r01_array));
ivanyohuno 1:42b43fa7362f 2172 memcpy(g01_array, decimalToBinary(room3[1][1]), sizeof(g01_array));
ivanyohuno 1:42b43fa7362f 2173 memcpy(b01_array, decimalToBinary(room3[1][2]), sizeof(b01_array));
ivanyohuno 1:42b43fa7362f 2174 int r02_array[8]; //LED2
ivanyohuno 1:42b43fa7362f 2175 int g02_array[8];
ivanyohuno 1:42b43fa7362f 2176 int b02_array[8];
ivanyohuno 1:42b43fa7362f 2177 memcpy(r02_array, decimalToBinary(room3[2][0]), sizeof(r02_array));
ivanyohuno 1:42b43fa7362f 2178 memcpy(g02_array, decimalToBinary(room3[2][1]), sizeof(g02_array));
ivanyohuno 1:42b43fa7362f 2179 memcpy(b02_array, decimalToBinary(room3[2][2]), sizeof(b02_array));
ivanyohuno 1:42b43fa7362f 2180 int r03_array[8]; //LED3
ivanyohuno 1:42b43fa7362f 2181 int g03_array[8];
ivanyohuno 1:42b43fa7362f 2182 int b03_array[8];
ivanyohuno 1:42b43fa7362f 2183 memcpy(r03_array, decimalToBinary(room3[3][0]), sizeof(r03_array));
ivanyohuno 1:42b43fa7362f 2184 memcpy(g03_array, decimalToBinary(room3[3][1]), sizeof(g03_array));
ivanyohuno 1:42b43fa7362f 2185 memcpy(b03_array, decimalToBinary(room3[3][2]), sizeof(b03_array));
ivanyohuno 1:42b43fa7362f 2186 int r04_array[8]; //LED4
ivanyohuno 1:42b43fa7362f 2187 int g04_array[8];
ivanyohuno 1:42b43fa7362f 2188 int b04_array[8];
ivanyohuno 1:42b43fa7362f 2189 memcpy(r04_array, decimalToBinary(room3[4][0]), sizeof(r04_array));
ivanyohuno 1:42b43fa7362f 2190 memcpy(g04_array, decimalToBinary(room3[4][1]), sizeof(g04_array));
ivanyohuno 1:42b43fa7362f 2191 memcpy(b04_array, decimalToBinary(room3[4][2]), sizeof(b04_array));
ivanyohuno 1:42b43fa7362f 2192 int r05_array[8]; //LED5
ivanyohuno 1:42b43fa7362f 2193 int g05_array[8];
ivanyohuno 1:42b43fa7362f 2194 int b05_array[8];
ivanyohuno 1:42b43fa7362f 2195 memcpy(r05_array, decimalToBinary(room3[5][0]), sizeof(r05_array));
ivanyohuno 1:42b43fa7362f 2196 memcpy(g05_array, decimalToBinary(room3[5][1]), sizeof(g05_array));
ivanyohuno 1:42b43fa7362f 2197 memcpy(b05_array, decimalToBinary(room3[5][2]), sizeof(b05_array));
ivanyohuno 1:42b43fa7362f 2198 int r06_array[8]; //LED6
ivanyohuno 1:42b43fa7362f 2199 int g06_array[8];
ivanyohuno 1:42b43fa7362f 2200 int b06_array[8];
ivanyohuno 1:42b43fa7362f 2201 memcpy(r06_array, decimalToBinary(room3[6][0]), sizeof(r06_array));
ivanyohuno 1:42b43fa7362f 2202 memcpy(g06_array, decimalToBinary(room3[6][1]), sizeof(g06_array));
ivanyohuno 1:42b43fa7362f 2203 memcpy(b06_array, decimalToBinary(room3[6][2]), sizeof(b06_array));
ivanyohuno 1:42b43fa7362f 2204 int r07_array[8]; //LED7
ivanyohuno 1:42b43fa7362f 2205 int g07_array[8];
ivanyohuno 1:42b43fa7362f 2206 int b07_array[8];
ivanyohuno 1:42b43fa7362f 2207 memcpy(r07_array, decimalToBinary(room3[7][0]), sizeof(r07_array));
ivanyohuno 1:42b43fa7362f 2208 memcpy(g07_array, decimalToBinary(room3[7][1]), sizeof(g07_array));
ivanyohuno 1:42b43fa7362f 2209 memcpy(b07_array, decimalToBinary(room3[7][2]), sizeof(b07_array));
ivanyohuno 1:42b43fa7362f 2210
ivanyohuno 1:42b43fa7362f 2211 //room4
ivanyohuno 1:42b43fa7362f 2212 int r10_array[8]; //LED0
ivanyohuno 1:42b43fa7362f 2213 int g10_array[8];
ivanyohuno 1:42b43fa7362f 2214 int b10_array[8];
ivanyohuno 1:42b43fa7362f 2215 memcpy(r10_array, decimalToBinary(room4[0][0]), sizeof(r10_array));
ivanyohuno 1:42b43fa7362f 2216 memcpy(g10_array, decimalToBinary(room4[0][1]), sizeof(g10_array));
ivanyohuno 1:42b43fa7362f 2217 memcpy(b10_array, decimalToBinary(room4[0][2]), sizeof(b10_array));
ivanyohuno 1:42b43fa7362f 2218 int r11_array[8]; //LED1
ivanyohuno 1:42b43fa7362f 2219 int g11_array[8];
ivanyohuno 1:42b43fa7362f 2220 int b11_array[8];
ivanyohuno 1:42b43fa7362f 2221 memcpy(r11_array, decimalToBinary(room4[1][0]), sizeof(r11_array));
ivanyohuno 1:42b43fa7362f 2222 memcpy(g11_array, decimalToBinary(room4[1][1]), sizeof(g11_array));
ivanyohuno 1:42b43fa7362f 2223 memcpy(b11_array, decimalToBinary(room4[1][2]), sizeof(b11_array));
ivanyohuno 1:42b43fa7362f 2224 int r12_array[8]; //LED2
ivanyohuno 1:42b43fa7362f 2225 int g12_array[8];
ivanyohuno 1:42b43fa7362f 2226 int b12_array[8];
ivanyohuno 1:42b43fa7362f 2227 memcpy(r12_array, decimalToBinary(room4[2][0]), sizeof(r12_array));
ivanyohuno 1:42b43fa7362f 2228 memcpy(g12_array, decimalToBinary(room4[2][1]), sizeof(g12_array));
ivanyohuno 1:42b43fa7362f 2229 memcpy(b12_array, decimalToBinary(room4[2][2]), sizeof(b12_array));
ivanyohuno 1:42b43fa7362f 2230 int r13_array[8]; //LED3
ivanyohuno 1:42b43fa7362f 2231 int g13_array[8];
ivanyohuno 1:42b43fa7362f 2232 int b13_array[8];
ivanyohuno 1:42b43fa7362f 2233 memcpy(r13_array, decimalToBinary(room4[3][0]), sizeof(r13_array));
ivanyohuno 1:42b43fa7362f 2234 memcpy(g13_array, decimalToBinary(room4[3][1]), sizeof(g13_array));
ivanyohuno 1:42b43fa7362f 2235 memcpy(b13_array, decimalToBinary(room4[3][2]), sizeof(b13_array));
ivanyohuno 1:42b43fa7362f 2236 int r14_array[8]; //LED4
ivanyohuno 1:42b43fa7362f 2237 int g14_array[8];
ivanyohuno 1:42b43fa7362f 2238 int b14_array[8];
ivanyohuno 1:42b43fa7362f 2239 memcpy(r14_array, decimalToBinary(room4[4][0]), sizeof(r14_array));
ivanyohuno 1:42b43fa7362f 2240 memcpy(g14_array, decimalToBinary(room4[4][1]), sizeof(g14_array));
ivanyohuno 1:42b43fa7362f 2241 memcpy(b14_array, decimalToBinary(room4[4][2]), sizeof(b14_array));
ivanyohuno 1:42b43fa7362f 2242 int r15_array[8]; //LED5
ivanyohuno 1:42b43fa7362f 2243 int g15_array[8];
ivanyohuno 1:42b43fa7362f 2244 int b15_array[8];
ivanyohuno 1:42b43fa7362f 2245 memcpy(r15_array, decimalToBinary(room4[5][0]), sizeof(r15_array));
ivanyohuno 1:42b43fa7362f 2246 memcpy(g15_array, decimalToBinary(room4[5][1]), sizeof(g15_array));
ivanyohuno 1:42b43fa7362f 2247 memcpy(b15_array, decimalToBinary(room4[5][2]), sizeof(b15_array));
ivanyohuno 1:42b43fa7362f 2248 int r16_array[8]; //LED6
ivanyohuno 1:42b43fa7362f 2249 int g16_array[8];
ivanyohuno 1:42b43fa7362f 2250 int b16_array[8];
ivanyohuno 1:42b43fa7362f 2251 memcpy(r16_array, decimalToBinary(room4[6][0]), sizeof(r16_array));
ivanyohuno 1:42b43fa7362f 2252 memcpy(g16_array, decimalToBinary(room4[6][1]), sizeof(g16_array));
ivanyohuno 1:42b43fa7362f 2253 memcpy(b16_array, decimalToBinary(room4[6][2]), sizeof(b16_array));
ivanyohuno 1:42b43fa7362f 2254 int r17_array[8]; //LED7
ivanyohuno 1:42b43fa7362f 2255 int g17_array[8];
ivanyohuno 1:42b43fa7362f 2256 int b17_array[8];
ivanyohuno 1:42b43fa7362f 2257 memcpy(r17_array, decimalToBinary(room4[7][0]), sizeof(r17_array));
ivanyohuno 1:42b43fa7362f 2258 memcpy(g17_array, decimalToBinary(room4[7][1]), sizeof(g17_array));
ivanyohuno 1:42b43fa7362f 2259 memcpy(b17_array, decimalToBinary(room4[7][2]), sizeof(b17_array));
ivanyohuno 1:42b43fa7362f 2260
ivanyohuno 1:42b43fa7362f 2261 //send commands to LED Driver
ivanyohuno 1:42b43fa7362f 2262 //initialize SPI
ivanyohuno 1:42b43fa7362f 2263 spi_init();
ivanyohuno 0:c350fa2f0c19 2264 //room3
ivanyohuno 0:c350fa2f0c19 2265 //LED0
ivanyohuno 0:c350fa2f0c19 2266 //set green bits
ivanyohuno 1:42b43fa7362f 2267 spi.write(g00_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2268 spi.write(g00_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2269 spi.write(g00_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2270 spi.write(g00_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2271 spi.write(g00_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2272 spi.write(g00_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2273 spi.write(g00_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2274 spi.write(g00_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2275 //set red bits
ivanyohuno 1:42b43fa7362f 2276 spi.write(r00_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2277 spi.write(r00_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2278 spi.write(r00_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2279 spi.write(r00_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2280 spi.write(r00_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2281 spi.write(r00_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2282 spi.write(r00_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2283 spi.write(r00_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2284 //set blue bits
ivanyohuno 1:42b43fa7362f 2285 spi.write(b00_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2286 spi.write(b00_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2287 spi.write(b00_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2288 spi.write(b00_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2289 spi.write(b00_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2290 spi.write(b00_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2291 spi.write(b00_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2292 spi.write(b00_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2293 //LED1
ivanyohuno 0:c350fa2f0c19 2294 //set green bits
ivanyohuno 1:42b43fa7362f 2295 spi.write(g01_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2296 spi.write(g01_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2297 spi.write(g01_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2298 spi.write(g01_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2299 spi.write(g01_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2300 spi.write(g01_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2301 spi.write(g01_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2302 spi.write(g01_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2303 //set red bits
ivanyohuno 1:42b43fa7362f 2304 spi.write(r01_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2305 spi.write(r01_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2306 spi.write(r01_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2307 spi.write(r01_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2308 spi.write(r01_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2309 spi.write(r01_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2310 spi.write(r01_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2311 spi.write(r01_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2312 //set blue bits
ivanyohuno 1:42b43fa7362f 2313 spi.write(b01_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2314 spi.write(b01_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2315 spi.write(b01_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2316 spi.write(b01_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2317 spi.write(b01_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2318 spi.write(b01_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2319 spi.write(b01_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2320 spi.write(b01_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2321 //LED2
ivanyohuno 0:c350fa2f0c19 2322 //set green bits
ivanyohuno 1:42b43fa7362f 2323 spi.write(g02_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2324 spi.write(g02_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2325 spi.write(g02_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2326 spi.write(g02_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2327 spi.write(g02_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2328 spi.write(g02_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2329 spi.write(g02_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2330 spi.write(g02_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2331 //set red bits
ivanyohuno 1:42b43fa7362f 2332 spi.write(r02_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2333 spi.write(r02_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2334 spi.write(r02_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2335 spi.write(r02_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2336 spi.write(r02_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2337 spi.write(r02_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2338 spi.write(r02_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2339 spi.write(r02_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2340 //set blue bits
ivanyohuno 1:42b43fa7362f 2341 spi.write(b02_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2342 spi.write(b02_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2343 spi.write(b02_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2344 spi.write(b02_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2345 spi.write(b02_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2346 spi.write(b02_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2347 spi.write(b02_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2348 spi.write(b02_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2349 //LED3
ivanyohuno 0:c350fa2f0c19 2350 //set green bits
ivanyohuno 1:42b43fa7362f 2351 spi.write(g03_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2352 spi.write(g03_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2353 spi.write(g03_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2354 spi.write(g03_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2355 spi.write(g03_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2356 spi.write(g03_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2357 spi.write(g03_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2358 spi.write(g03_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2359 //set red bits
ivanyohuno 1:42b43fa7362f 2360 spi.write(r03_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2361 spi.write(r03_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2362 spi.write(r03_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2363 spi.write(r03_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2364 spi.write(r03_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2365 spi.write(r03_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2366 spi.write(r03_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2367 spi.write(r03_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2368 //set blue bits
ivanyohuno 1:42b43fa7362f 2369 spi.write(b03_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2370 spi.write(b03_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2371 spi.write(b03_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2372 spi.write(b03_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2373 spi.write(b03_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2374 spi.write(b03_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2375 spi.write(b03_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2376 spi.write(b03_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2377 //LED4
ivanyohuno 0:c350fa2f0c19 2378 //set green bits
ivanyohuno 1:42b43fa7362f 2379 spi.write(g04_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2380 spi.write(g04_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2381 spi.write(g04_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2382 spi.write(g04_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2383 spi.write(g04_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2384 spi.write(g04_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2385 spi.write(g04_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2386 spi.write(g04_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2387 //set red bits
ivanyohuno 1:42b43fa7362f 2388 spi.write(r04_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2389 spi.write(r04_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2390 spi.write(r04_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2391 spi.write(r04_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2392 spi.write(r04_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2393 spi.write(r04_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2394 spi.write(r04_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2395 spi.write(r04_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2396 //set blue bits
ivanyohuno 1:42b43fa7362f 2397 spi.write(b04_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2398 spi.write(b04_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2399 spi.write(b04_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2400 spi.write(b04_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2401 spi.write(b04_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2402 spi.write(b04_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2403 spi.write(b04_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2404 spi.write(b04_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2405 //LED5
ivanyohuno 0:c350fa2f0c19 2406 //set green bits
ivanyohuno 1:42b43fa7362f 2407 spi.write(g05_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2408 spi.write(g05_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2409 spi.write(g05_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2410 spi.write(g05_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2411 spi.write(g05_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2412 spi.write(g05_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2413 spi.write(g05_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2414 spi.write(g05_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2415 //set red bits
ivanyohuno 1:42b43fa7362f 2416 spi.write(r05_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2417 spi.write(r05_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2418 spi.write(r05_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2419 spi.write(r05_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2420 spi.write(r05_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2421 spi.write(r05_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2422 spi.write(r05_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2423 spi.write(r05_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2424 //set blue bits
ivanyohuno 1:42b43fa7362f 2425 spi.write(b05_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2426 spi.write(b05_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2427 spi.write(b05_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2428 spi.write(b05_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2429 spi.write(b05_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2430 spi.write(b05_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2431 spi.write(b05_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2432 spi.write(b05_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2433 //LED6
ivanyohuno 0:c350fa2f0c19 2434 //set green bits
ivanyohuno 1:42b43fa7362f 2435 spi.write(g06_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2436 spi.write(g06_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2437 spi.write(g06_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2438 spi.write(g06_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2439 spi.write(g06_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2440 spi.write(g06_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2441 spi.write(g06_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2442 spi.write(g06_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2443 //set red bits
ivanyohuno 1:42b43fa7362f 2444 spi.write(r06_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2445 spi.write(r06_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2446 spi.write(r06_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2447 spi.write(r06_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2448 spi.write(r06_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2449 spi.write(r06_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2450 spi.write(r06_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2451 spi.write(r06_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2452 //set blue bits
ivanyohuno 1:42b43fa7362f 2453 spi.write(b06_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2454 spi.write(b06_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2455 spi.write(b06_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2456 spi.write(b06_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2457 spi.write(b06_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2458 spi.write(b06_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2459 spi.write(b06_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2460 spi.write(b06_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2461 //LED7
ivanyohuno 0:c350fa2f0c19 2462 //set green bits
ivanyohuno 1:42b43fa7362f 2463 spi.write(g07_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2464 spi.write(g07_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2465 spi.write(g07_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2466 spi.write(g07_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2467 spi.write(g07_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2468 spi.write(g07_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2469 spi.write(g07_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2470 spi.write(g07_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2471 //set red bits
ivanyohuno 1:42b43fa7362f 2472 spi.write(r07_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2473 spi.write(r07_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2474 spi.write(r07_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2475 spi.write(r07_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2476 spi.write(r07_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2477 spi.write(r07_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2478 spi.write(r07_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2479 spi.write(r07_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2480 //set blue bits
ivanyohuno 1:42b43fa7362f 2481 spi.write(b07_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2482 spi.write(b07_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2483 spi.write(b07_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2484 spi.write(b07_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2485 spi.write(b07_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2486 spi.write(b07_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2487 spi.write(b07_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2488 spi.write(b07_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2489 //room4
ivanyohuno 0:c350fa2f0c19 2490 //LED0
ivanyohuno 0:c350fa2f0c19 2491 //set green bits
ivanyohuno 1:42b43fa7362f 2492 spi.write(g10_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2493 spi.write(g10_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2494 spi.write(g10_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2495 spi.write(g10_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2496 spi.write(g10_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2497 spi.write(g10_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2498 spi.write(g10_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2499 spi.write(g10_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2500 //set red bits
ivanyohuno 1:42b43fa7362f 2501 spi.write(r10_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2502 spi.write(r10_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2503 spi.write(r10_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2504 spi.write(r10_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2505 spi.write(r10_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2506 spi.write(r10_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2507 spi.write(r10_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2508 spi.write(r10_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2509 //set blue bits
ivanyohuno 1:42b43fa7362f 2510 spi.write(b10_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2511 spi.write(b10_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2512 spi.write(b10_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2513 spi.write(b10_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2514 spi.write(b10_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2515 spi.write(b10_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2516 spi.write(b10_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2517 spi.write(b10_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2518 //LED1
ivanyohuno 0:c350fa2f0c19 2519 //set green bits
ivanyohuno 1:42b43fa7362f 2520 spi.write(g11_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2521 spi.write(g11_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2522 spi.write(g11_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2523 spi.write(g11_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2524 spi.write(g11_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2525 spi.write(g11_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2526 spi.write(g11_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2527 spi.write(g11_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2528 //set red bits
ivanyohuno 1:42b43fa7362f 2529 spi.write(r11_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2530 spi.write(r11_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2531 spi.write(r11_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2532 spi.write(r11_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2533 spi.write(r11_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2534 spi.write(r11_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2535 spi.write(r11_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2536 spi.write(r11_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2537 //set blue bits
ivanyohuno 1:42b43fa7362f 2538 spi.write(b11_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2539 spi.write(b11_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2540 spi.write(b11_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2541 spi.write(b11_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2542 spi.write(b11_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2543 spi.write(b11_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2544 spi.write(b11_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2545 spi.write(b11_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2546 //LED2
ivanyohuno 0:c350fa2f0c19 2547 //set green bits
ivanyohuno 1:42b43fa7362f 2548 spi.write(g12_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2549 spi.write(g12_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2550 spi.write(g12_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2551 spi.write(g12_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2552 spi.write(g12_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2553 spi.write(g12_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2554 spi.write(g12_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2555 spi.write(g12_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2556 //set red bits
ivanyohuno 1:42b43fa7362f 2557 spi.write(r12_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2558 spi.write(r12_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2559 spi.write(r12_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2560 spi.write(r12_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2561 spi.write(r12_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2562 spi.write(r12_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2563 spi.write(r12_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2564 spi.write(r12_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2565 //set blue bits
ivanyohuno 1:42b43fa7362f 2566 spi.write(b12_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2567 spi.write(b12_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2568 spi.write(b12_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2569 spi.write(b12_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2570 spi.write(b12_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2571 spi.write(b12_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2572 spi.write(b12_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2573 spi.write(b12_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2574 //LED3
ivanyohuno 0:c350fa2f0c19 2575 //set green bits
ivanyohuno 1:42b43fa7362f 2576 spi.write(g13_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2577 spi.write(g13_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2578 spi.write(g13_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2579 spi.write(g13_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2580 spi.write(g13_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2581 spi.write(g13_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2582 spi.write(g13_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2583 spi.write(g13_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2584 //set red bits
ivanyohuno 1:42b43fa7362f 2585 spi.write(r13_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2586 spi.write(r13_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2587 spi.write(r13_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2588 spi.write(r13_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2589 spi.write(r13_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2590 spi.write(r13_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2591 spi.write(r13_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2592 spi.write(r13_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2593 //set blue bits
ivanyohuno 1:42b43fa7362f 2594 spi.write(b13_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2595 spi.write(b13_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2596 spi.write(b13_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2597 spi.write(b13_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2598 spi.write(b13_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2599 spi.write(b13_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2600 spi.write(b13_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2601 spi.write(b13_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2602 //LED4
ivanyohuno 0:c350fa2f0c19 2603 //set green bits
ivanyohuno 1:42b43fa7362f 2604 spi.write(g14_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2605 spi.write(g14_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2606 spi.write(g14_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2607 spi.write(g14_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2608 spi.write(g14_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2609 spi.write(g14_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2610 spi.write(g14_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2611 spi.write(g14_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2612 //set red bits
ivanyohuno 1:42b43fa7362f 2613 spi.write(r14_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2614 spi.write(r14_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2615 spi.write(r14_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2616 spi.write(r14_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2617 spi.write(r14_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2618 spi.write(r14_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2619 spi.write(r14_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2620 spi.write(r14_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2621 //set blue bits
ivanyohuno 1:42b43fa7362f 2622 spi.write(b14_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2623 spi.write(b14_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2624 spi.write(b14_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2625 spi.write(b14_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2626 spi.write(b14_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2627 spi.write(b14_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2628 spi.write(b14_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2629 spi.write(b14_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2630 //LED5
ivanyohuno 0:c350fa2f0c19 2631 //set green bits
ivanyohuno 1:42b43fa7362f 2632 spi.write(g15_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2633 spi.write(g15_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2634 spi.write(g15_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2635 spi.write(g15_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2636 spi.write(g15_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2637 spi.write(g15_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2638 spi.write(g15_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2639 spi.write(g15_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2640 //set red bits
ivanyohuno 1:42b43fa7362f 2641 spi.write(r15_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2642 spi.write(r15_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2643 spi.write(r15_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2644 spi.write(r15_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2645 spi.write(r15_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2646 spi.write(r15_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2647 spi.write(r15_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2648 spi.write(r15_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2649 //set blue bits
ivanyohuno 1:42b43fa7362f 2650 spi.write(b15_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2651 spi.write(b15_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2652 spi.write(b15_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2653 spi.write(b15_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2654 spi.write(b15_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2655 spi.write(b15_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2656 spi.write(b15_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2657 spi.write(b15_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2658 //LED6
ivanyohuno 0:c350fa2f0c19 2659 //set green bits
ivanyohuno 1:42b43fa7362f 2660 spi.write(g16_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2661 spi.write(g16_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2662 spi.write(g16_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2663 spi.write(g16_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2664 spi.write(g16_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2665 spi.write(g16_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2666 spi.write(g16_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2667 spi.write(g16_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2668 //set red bits
ivanyohuno 1:42b43fa7362f 2669 spi.write(r16_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2670 spi.write(r16_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2671 spi.write(r16_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2672 spi.write(r16_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2673 spi.write(r16_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2674 spi.write(r16_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2675 spi.write(r16_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2676 spi.write(r16_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2677 //set blue bits
ivanyohuno 1:42b43fa7362f 2678 spi.write(b16_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2679 spi.write(b16_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2680 spi.write(b16_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2681 spi.write(b16_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2682 spi.write(b16_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2683 spi.write(b16_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2684 spi.write(b16_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2685 spi.write(b16_array[0]); //set b0 bit
ivanyohuno 0:c350fa2f0c19 2686 //LED7
ivanyohuno 0:c350fa2f0c19 2687 //set green bits
ivanyohuno 1:42b43fa7362f 2688 spi.write(g17_array[7]); //set g7 bit
ivanyohuno 1:42b43fa7362f 2689 spi.write(g17_array[6]); //set g6 bit
ivanyohuno 1:42b43fa7362f 2690 spi.write(g17_array[5]); //set g5 bit
ivanyohuno 1:42b43fa7362f 2691 spi.write(g17_array[4]); //set g4 bit
ivanyohuno 1:42b43fa7362f 2692 spi.write(g17_array[3]); //set g3 bit
ivanyohuno 1:42b43fa7362f 2693 spi.write(g17_array[2]); //set g2 bit
ivanyohuno 1:42b43fa7362f 2694 spi.write(g17_array[1]); //set g1 bit
ivanyohuno 1:42b43fa7362f 2695 spi.write(g17_array[0]);//set g0 bit
ivanyohuno 0:c350fa2f0c19 2696 //set red bits
ivanyohuno 1:42b43fa7362f 2697 spi.write(r17_array[7]);//set r7 bit
ivanyohuno 1:42b43fa7362f 2698 spi.write(r17_array[6]); //set r6 bit
ivanyohuno 1:42b43fa7362f 2699 spi.write(r17_array[5]); //set r5 bit
ivanyohuno 1:42b43fa7362f 2700 spi.write(r17_array[4]); //set r4 bit
ivanyohuno 1:42b43fa7362f 2701 spi.write(r17_array[3]); //set r3 bit
ivanyohuno 1:42b43fa7362f 2702 spi.write(r17_array[2]); //set r2 bit
ivanyohuno 1:42b43fa7362f 2703 spi.write(r17_array[1]); //set r1 bit
ivanyohuno 1:42b43fa7362f 2704 spi.write(r17_array[0]); //set r0 bit
ivanyohuno 0:c350fa2f0c19 2705 //set blue bits
ivanyohuno 1:42b43fa7362f 2706 spi.write(b17_array[7]); //set b7 bit
ivanyohuno 1:42b43fa7362f 2707 spi.write(b17_array[6]); //set b6 bit
ivanyohuno 1:42b43fa7362f 2708 spi.write(b17_array[5]); //set b5 bit
ivanyohuno 1:42b43fa7362f 2709 spi.write(b17_array[4]); //set b4 bit
ivanyohuno 1:42b43fa7362f 2710 spi.write(b17_array[3]); //set b3 bit
ivanyohuno 1:42b43fa7362f 2711 spi.write(b17_array[2]); //set b2 bit
ivanyohuno 1:42b43fa7362f 2712 spi.write(b17_array[1]); //set b1 bit
ivanyohuno 1:42b43fa7362f 2713 spi.write(b17_array[0]); //set b0 bit
ivanyohuno 1:42b43fa7362f 2714
ivanyohuno 0:c350fa2f0c19 2715 //wait for latch
ivanyohuno 0:c350fa2f0c19 2716 wait_us(60);
ivanyohuno 0:c350fa2f0c19 2717 }
ivanyohuno 0:c350fa2f0c19 2718
ivanyohuno 0:c350fa2f0c19 2719 int * decimalToBinary(int n) // converts decimal value to 8 bit array of 1's (0xFF0) and 0's (0xF00)
ivanyohuno 0:c350fa2f0c19 2720 {
ivanyohuno 0:c350fa2f0c19 2721 int reminder;
ivanyohuno 0:c350fa2f0c19 2722 int i=0;
ivanyohuno 0:c350fa2f0c19 2723 int static binary[8]; //initialize to 00000000
ivanyohuno 0:c350fa2f0c19 2724 while (n!=0)
ivanyohuno 0:c350fa2f0c19 2725 {
ivanyohuno 0:c350fa2f0c19 2726 reminder=n%2;
ivanyohuno 0:c350fa2f0c19 2727 if(reminder == 1){
ivanyohuno 0:c350fa2f0c19 2728 binary[i] = 0xFF0;
ivanyohuno 0:c350fa2f0c19 2729 }
ivanyohuno 0:c350fa2f0c19 2730 if(reminder == 0){
ivanyohuno 0:c350fa2f0c19 2731 binary[i] = 0xF00;
ivanyohuno 0:c350fa2f0c19 2732 }
ivanyohuno 0:c350fa2f0c19 2733 n = n/2;
ivanyohuno 0:c350fa2f0c19 2734 i++;
ivanyohuno 0:c350fa2f0c19 2735 }
ivanyohuno 0:c350fa2f0c19 2736 //sets the remainder of the digits to 0xF00 if n reaches 0 before i = 7
ivanyohuno 0:c350fa2f0c19 2737 for(;i<8;i++){
ivanyohuno 0:c350fa2f0c19 2738 binary[i] = 0xF00;
ivanyohuno 0:c350fa2f0c19 2739 }
ivanyohuno 0:c350fa2f0c19 2740 return binary;
ivanyohuno 0:c350fa2f0c19 2741 }
ivanyohuno 0:c350fa2f0c19 2742
ivanyohuno 0:c350fa2f0c19 2743 void spi_init(){ //initializes spi port to send 0 bit length
ivanyohuno 1:42b43fa7362f 2744 spi1.format(14, 0); //set spi at 14 bits/byte with clock phase and clock polarity at mode 0
ivanyohuno 1:42b43fa7362f 2745 spi1.frequency(10600000); //set frequency of spi clock at 96/9 - 10.6MHz 94.3 ns bit time length
ivanyohuno 1:42b43fa7362f 2746 spi2.format(14, 0); //set spi at 14 bits/byte with clock phase and clock polarity at mode 0
ivanyohuno 1:42b43fa7362f 2747 spi2.frequency(10600000); //set frequency of spi clock at 96/9 - 10.6MHz 94.3 ns bit time length
ivanyohuno 1:42b43fa7362f 2748
ivanyohuno 0:c350fa2f0c19 2749 }
ivanyohuno 0:c350fa2f0c19 2750