Code to work with NeoPixels

Dependencies:   NeoStrip mbed

Committer:
ivanyohuno
Date:
Wed Apr 22 14:08:15 2015 +0000
Revision:
0:c350fa2f0c19
Child:
1:42b43fa7362f
for ekanem

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