rsp to mbed
Dependencies: mbed neopixels_spi
Fork of RSP_receivefunction by
main.cpp@1:bcb384b83f54, 2015-05-13 (annotated)
- Committer:
- el12moe
- Date:
- Wed May 13 21:07:14 2015 +0000
- Revision:
- 1:bcb384b83f54
- Parent:
- 0:3f93f42809e5
rsp
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el12moe | 0:3f93f42809e5 | 1 | #include "mbed.h" |
el12moe | 0:3f93f42809e5 | 2 | |
el12moe | 1:bcb384b83f54 | 3 | #include "neopixels_spi.h" |
el12moe | 1:bcb384b83f54 | 4 | |
el12moe | 1:bcb384b83f54 | 5 | DigitalOut myled(LED1); |
el12moe | 1:bcb384b83f54 | 6 | neopixels_spi lights; |
el12moe | 1:bcb384b83f54 | 7 | Ticker xmas; |
el12moe | 1:bcb384b83f54 | 8 | |
el12moe | 0:3f93f42809e5 | 9 | Serial pi(USBTX, USBRX);// Initialse USB serial port |
el12moe | 0:3f93f42809e5 | 10 | void mbedReceive(void); |
el12moe | 0:3f93f42809e5 | 11 | void modeActivated(void); |
el12moe | 0:3f93f42809e5 | 12 | void security(void); |
el12moe | 0:3f93f42809e5 | 13 | void brightness(void); |
el12moe | 0:3f93f42809e5 | 14 | void colour(void); |
el12moe | 0:3f93f42809e5 | 15 | void festive(void); |
el12moe | 0:3f93f42809e5 | 16 | void sleep(void); |
el12moe | 0:3f93f42809e5 | 17 | void presetBrightness(void); |
el12moe | 0:3f93f42809e5 | 18 | void presetColour(void); |
el12moe | 0:3f93f42809e5 | 19 | void christmas(void); |
el12moe | 0:3f93f42809e5 | 20 | void hunika(void); |
el12moe | 0:3f93f42809e5 | 21 | void akwansa(void); |
el12moe | 0:3f93f42809e5 | 22 | void rainbow(void); |
el12moe | 1:bcb384b83f54 | 23 | void rgbm(void); |
el12moe | 0:3f93f42809e5 | 24 | void christmas2(void); |
el12moe | 0:3f93f42809e5 | 25 | void hunika2(void); |
el12moe | 0:3f93f42809e5 | 26 | void akwansa2(void); |
el12moe | 0:3f93f42809e5 | 27 | void rainbow2(void); |
el12moe | 1:bcb384b83f54 | 28 | void rgbm2(void); |
el12moe | 0:3f93f42809e5 | 29 | |
el12moe | 1:bcb384b83f54 | 30 | //RSP packets dependencies |
el12moe | 0:3f93f42809e5 | 31 | int room=0; |
el12moe | 0:3f93f42809e5 | 32 | int mode=0; |
el12moe | 0:3f93f42809e5 | 33 | int red=0; |
el12moe | 0:3f93f42809e5 | 34 | int green=0; |
el12moe | 0:3f93f42809e5 | 35 | int blue=0; |
el12moe | 0:3f93f42809e5 | 36 | |
el12moe | 1:bcb384b83f54 | 37 | //lights mode dependencies |
el12moe | 1:bcb384b83f54 | 38 | int rg[8][3] = {{255,0,0},{0,255,0},{255,0,0},{0,255,0},{255,0,0},{0,255,0},{255,0,0},{0,225,0}}; |
el12moe | 1:bcb384b83f54 | 39 | int gr[8][3] = {{0,255,0},{255,0,0},{0,255,0},{255,0,0},{0,255,0},{255,0,0},{0,225,0},{255,0,0}}; |
el12moe | 1:bcb384b83f54 | 40 | |
el12moe | 1:bcb384b83f54 | 41 | int bw[8][3] = {{0,0,255},{255,255,255},{0,0,255},{255,255,255},{0,0,255},{255,255,255},{0,0,255},{255,255,255}}; |
el12moe | 1:bcb384b83f54 | 42 | int wb[8][3] = {{255,255,255},{0,0,255},{255,255,255},{0,0,255},{255,255,255},{0,0,255},{255,255,255},{0,0,255}}; |
el12moe | 1:bcb384b83f54 | 43 | |
el12moe | 1:bcb384b83f54 | 44 | int rgb[8][3] = {{255,0,0},{0,255,0},{0,0,255},{255,0,0},{0,255,0},{0,0,255},{255,0,0},{0,255,0}}; |
el12moe | 1:bcb384b83f54 | 45 | int brg[8][3] = {{0,0,255},{255,0,0},{0,255,0},{0,0,255},{255,0,0},{0,255,0},{0,0,255},{255,0,0}}; |
el12moe | 1:bcb384b83f54 | 46 | int gbr[8][3] = {{0,255,0},{0,0,255},{255,0,0},{0,255,0},{0,0,255},{255,0,0},{0,255,0},{0,0,255}}; |
el12moe | 1:bcb384b83f54 | 47 | int bgr[8][3] = {{0,0,255},{0,255,0},{255,0,0},{0,0,255},{0,255,0},{255,0,0},{0,0,255},{0,255,0}}; |
el12moe | 1:bcb384b83f54 | 48 | |
el12moe | 1:bcb384b83f54 | 49 | int ak1[8][3] = {{255,0,0},{0,255,0},{0,0,0},{255,0,0},{0,255,0},{0,0,0},{255,0,0},{0,255,0}}; |
el12moe | 1:bcb384b83f54 | 50 | int ak2[8][3] = {{0,0,0},{255,0,0},{0,255,0},{0,0,0},{255,0,0},{0,255,0},{0,0,0},{255,0,0}}; |
el12moe | 1:bcb384b83f54 | 51 | int ak3[8][3] = {{0,255,0},{0,0,0},{255,0,0},{0,255,0},{0,0,0},{255,0,0},{0,255,0},{0,0,0}}; |
el12moe | 1:bcb384b83f54 | 52 | int ak4[8][3] = {{0,0,0},{0,255,0},{255,0,0},{0,0,0},{0,255,0},{255,0,0},{0,0,0},{0,255,0}}; |
el12moe | 1:bcb384b83f54 | 53 | |
el12moe | 1:bcb384b83f54 | 54 | int ra1[8][3] = {{255,0,0},{255,165,0},{255,255,0},{255,255,255},{0,255,0},{0,0,255},{75,0,255},{238,130,238}}; |
el12moe | 1:bcb384b83f54 | 55 | int ra2[8][3] = {{255,165,0},{255,255,0},{255,255,255},{0,255,0},{0,0,255},{75,0,255},{238,130,238},{255,0,0}}; |
el12moe | 1:bcb384b83f54 | 56 | int ra3[8][3] = {{255,255,0},{255,255,255},{0,255,0},{0,0,255},{75,0,255},{238,130,238},{255,0,0},{255,165,0}}; |
el12moe | 1:bcb384b83f54 | 57 | int ra4[8][3] = {{255,255,255},{0,255,0},{0,0,255},{75,0,255},{238,130,238},{255,0,0},{255,165,0},{255,255,0}}; |
el12moe | 1:bcb384b83f54 | 58 | int ra5[8][3] = {{0,255,0},{0,0,255},{75,0,255},{238,130,238},{255,0,0},{255,165,0},{255,255,0},{255,255,255}}; |
el12moe | 1:bcb384b83f54 | 59 | int ra6[8][3] = {{0,0,255},{75,0,255},{238,130,238},{255,0,0},{255,165,0},{255,255,0},{255,255,255},{0,255,0}}; |
el12moe | 1:bcb384b83f54 | 60 | int ra7[8][3] = {{75,0,255},{238,130,238},{255,0,0},{255,165,0},{255,255,0},{255,255,255},{0,255,0},{0,0,255}}; |
el12moe | 1:bcb384b83f54 | 61 | int ra8[8][3] = {{238,130,238},{255,0,0},{255,165,0},{255,255,0},{255,255,255},{0,255,0},{0,0,255},{75,0,255}}; |
el12moe | 1:bcb384b83f54 | 62 | |
el12moe | 0:3f93f42809e5 | 63 | |
el12moe | 0:3f93f42809e5 | 64 | int main() { |
el12moe | 0:3f93f42809e5 | 65 | while(1) { |
el12moe | 0:3f93f42809e5 | 66 | if(pi.readable()){ |
el12moe | 0:3f93f42809e5 | 67 | modeActivated(); |
el12moe | 0:3f93f42809e5 | 68 | //mbedReceive(); |
el12moe | 0:3f93f42809e5 | 69 | } |
el12moe | 0:3f93f42809e5 | 70 | } |
el12moe | 0:3f93f42809e5 | 71 | } |
el12moe | 0:3f93f42809e5 | 72 | |
el12moe | 0:3f93f42809e5 | 73 | // function to receive stuff from pi |
el12moe | 0:3f93f42809e5 | 74 | void mbedReceive(void){ |
el12moe | 0:3f93f42809e5 | 75 | int section = pi.getc(); |
el12moe | 0:3f93f42809e5 | 76 | if (section==1){ |
el12moe | 0:3f93f42809e5 | 77 | security(); //activate security mode |
el12moe | 0:3f93f42809e5 | 78 | } |
el12moe | 0:3f93f42809e5 | 79 | else if (section==2){ |
el12moe | 0:3f93f42809e5 | 80 | room = pi.getc(); |
el12moe | 0:3f93f42809e5 | 81 | mode = pi.getc(); |
el12moe | 0:3f93f42809e5 | 82 | red = pi.getc(); |
el12moe | 0:3f93f42809e5 | 83 | green = pi.getc(); |
el12moe | 0:3f93f42809e5 | 84 | blue = pi.getc(); |
el12moe | 0:3f93f42809e5 | 85 | } |
el12moe | 0:3f93f42809e5 | 86 | else if (section==0){ |
el12moe | 0:3f93f42809e5 | 87 | //normal lights function a way of stopping different light modes |
el12moe | 1:bcb384b83f54 | 88 | // b2() stop alarm |
el12moe | 1:bcb384b83f54 | 89 | room = pi.getc(); |
el12moe | 1:bcb384b83f54 | 90 | if (room==1){ |
el12moe | 1:bcb384b83f54 | 91 | //normal mode 1 |
el12moe | 1:bcb384b83f54 | 92 | } |
el12moe | 1:bcb384b83f54 | 93 | else if (room==2){ |
el12moe | 1:bcb384b83f54 | 94 | //normal mode 2 |
el12moe | 1:bcb384b83f54 | 95 | } |
el12moe | 1:bcb384b83f54 | 96 | |
el12moe | 0:3f93f42809e5 | 97 | } |
el12moe | 0:3f93f42809e5 | 98 | } |
el12moe | 0:3f93f42809e5 | 99 | |
el12moe | 0:3f93f42809e5 | 100 | void modeActivated(void){ |
el12moe | 0:3f93f42809e5 | 101 | mbedReceive(); |
el12moe | 0:3f93f42809e5 | 102 | if (mode==1){ |
el12moe | 0:3f93f42809e5 | 103 | brightness(); |
el12moe | 0:3f93f42809e5 | 104 | } |
el12moe | 0:3f93f42809e5 | 105 | if (mode==2){ |
el12moe | 0:3f93f42809e5 | 106 | colour(); |
el12moe | 0:3f93f42809e5 | 107 | } |
el12moe | 0:3f93f42809e5 | 108 | if (mode==3){ |
el12moe | 0:3f93f42809e5 | 109 | festive(); |
el12moe | 0:3f93f42809e5 | 110 | } |
el12moe | 0:3f93f42809e5 | 111 | if (mode==4){ |
el12moe | 0:3f93f42809e5 | 112 | sleep(); |
el12moe | 0:3f93f42809e5 | 113 | } |
el12moe | 0:3f93f42809e5 | 114 | if (mode==5){ |
el12moe | 0:3f93f42809e5 | 115 | presetBrightness(); |
el12moe | 0:3f93f42809e5 | 116 | } |
el12moe | 0:3f93f42809e5 | 117 | if (mode==6){ |
el12moe | 0:3f93f42809e5 | 118 | presetColour(); |
el12moe | 0:3f93f42809e5 | 119 | } |
el12moe | 0:3f93f42809e5 | 120 | |
el12moe | 0:3f93f42809e5 | 121 | } |
el12moe | 0:3f93f42809e5 | 122 | |
el12moe | 0:3f93f42809e5 | 123 | void security(void){ |
el12moe | 0:3f93f42809e5 | 124 | |
el12moe | 0:3f93f42809e5 | 125 | } |
el12moe | 0:3f93f42809e5 | 126 | |
el12moe | 0:3f93f42809e5 | 127 | void brightness(void){ |
el12moe | 0:3f93f42809e5 | 128 | if (room==1){ |
el12moe | 1:bcb384b83f54 | 129 | lights.setRGBStrip1(red, red, red); |
el12moe | 0:3f93f42809e5 | 130 | } |
el12moe | 0:3f93f42809e5 | 131 | if (room==2){ |
el12moe | 1:bcb384b83f54 | 132 | lights.setRGBStrip2(red, red, red); |
el12moe | 0:3f93f42809e5 | 133 | } |
el12moe | 0:3f93f42809e5 | 134 | } |
el12moe | 0:3f93f42809e5 | 135 | void colour(void){ |
el12moe | 0:3f93f42809e5 | 136 | if (room==1){ |
el12moe | 1:bcb384b83f54 | 137 | lights.setRGBStrip1(red, green, blue); |
el12moe | 0:3f93f42809e5 | 138 | } |
el12moe | 0:3f93f42809e5 | 139 | if (room==2){ |
el12moe | 1:bcb384b83f54 | 140 | lights.setRGBStrip2(red, green, blue); |
el12moe | 0:3f93f42809e5 | 141 | } |
el12moe | 0:3f93f42809e5 | 142 | |
el12moe | 0:3f93f42809e5 | 143 | } |
el12moe | 0:3f93f42809e5 | 144 | void festive(void){ |
el12moe | 0:3f93f42809e5 | 145 | if (room==1){ |
el12moe | 0:3f93f42809e5 | 146 | if(red==1){ |
el12moe | 1:bcb384b83f54 | 147 | christmas(); |
el12moe | 0:3f93f42809e5 | 148 | } |
el12moe | 0:3f93f42809e5 | 149 | if(red==2){ |
el12moe | 0:3f93f42809e5 | 150 | hunika(); |
el12moe | 0:3f93f42809e5 | 151 | } |
el12moe | 0:3f93f42809e5 | 152 | if(red==3){ |
el12moe | 0:3f93f42809e5 | 153 | akwansa(); |
el12moe | 0:3f93f42809e5 | 154 | } |
el12moe | 0:3f93f42809e5 | 155 | if(red==4){ |
el12moe | 0:3f93f42809e5 | 156 | rainbow(); |
el12moe | 0:3f93f42809e5 | 157 | } |
el12moe | 0:3f93f42809e5 | 158 | if(red==5){ |
el12moe | 1:bcb384b83f54 | 159 | rgbm(); |
el12moe | 0:3f93f42809e5 | 160 | } |
el12moe | 0:3f93f42809e5 | 161 | } |
el12moe | 0:3f93f42809e5 | 162 | else if (room==2){ |
el12moe | 0:3f93f42809e5 | 163 | if(red==1){ |
el12moe | 1:bcb384b83f54 | 164 | |
el12moe | 0:3f93f42809e5 | 165 | christmas2(); |
el12moe | 0:3f93f42809e5 | 166 | } |
el12moe | 0:3f93f42809e5 | 167 | if(red==2){ |
el12moe | 0:3f93f42809e5 | 168 | hunika2(); |
el12moe | 0:3f93f42809e5 | 169 | } |
el12moe | 0:3f93f42809e5 | 170 | if(red==3){ |
el12moe | 0:3f93f42809e5 | 171 | akwansa2(); |
el12moe | 0:3f93f42809e5 | 172 | } |
el12moe | 0:3f93f42809e5 | 173 | if(red==4){ |
el12moe | 0:3f93f42809e5 | 174 | rainbow2(); |
el12moe | 0:3f93f42809e5 | 175 | } |
el12moe | 0:3f93f42809e5 | 176 | if(red==5){ |
el12moe | 1:bcb384b83f54 | 177 | rgbm2(); |
el12moe | 0:3f93f42809e5 | 178 | } |
el12moe | 0:3f93f42809e5 | 179 | } |
el12moe | 0:3f93f42809e5 | 180 | } |
el12moe | 0:3f93f42809e5 | 181 | void sleep(void){ |
el12moe | 0:3f93f42809e5 | 182 | if (room==1){ |
el12moe | 0:3f93f42809e5 | 183 | // setRGBStrip1(red, green, blue); sleep pattern for strip1 |
el12moe | 0:3f93f42809e5 | 184 | } |
el12moe | 0:3f93f42809e5 | 185 | if (room==2){ |
el12moe | 0:3f93f42809e5 | 186 | // setRGBStrip2(red, green, blue);sleep pattern for strip1 |
el12moe | 0:3f93f42809e5 | 187 | } |
el12moe | 0:3f93f42809e5 | 188 | } |
el12moe | 0:3f93f42809e5 | 189 | void presetBrightness(void){ |
el12moe | 0:3f93f42809e5 | 190 | |
el12moe | 0:3f93f42809e5 | 191 | } |
el12moe | 0:3f93f42809e5 | 192 | void presetColour(void){ |
el12moe | 0:3f93f42809e5 | 193 | |
el12moe | 0:3f93f42809e5 | 194 | } |
el12moe | 0:3f93f42809e5 | 195 | |
el12moe | 1:bcb384b83f54 | 196 | //xmas red & green |
el12moe | 0:3f93f42809e5 | 197 | void christmas(void){ |
el12moe | 1:bcb384b83f54 | 198 | lights.setRGBPixels1(rg); |
el12moe | 1:bcb384b83f54 | 199 | wait(1); |
el12moe | 1:bcb384b83f54 | 200 | lights.setRGBPixels1(gr); |
el12moe | 1:bcb384b83f54 | 201 | wait(1); |
el12moe | 1:bcb384b83f54 | 202 | lights.setRGBPixels1(rg); |
el12moe | 1:bcb384b83f54 | 203 | wait(1); |
el12moe | 1:bcb384b83f54 | 204 | lights.setRGBPixels1(gr); |
el12moe | 1:bcb384b83f54 | 205 | wait(1); |
el12moe | 1:bcb384b83f54 | 206 | lights.setRGBPixels1(rg); |
el12moe | 1:bcb384b83f54 | 207 | wait(1); |
el12moe | 1:bcb384b83f54 | 208 | lights.setRGBPixels1(gr); |
el12moe | 1:bcb384b83f54 | 209 | wait(1); |
el12moe | 1:bcb384b83f54 | 210 | lights.setRGBPixels1(rg); |
el12moe | 1:bcb384b83f54 | 211 | wait(1); |
el12moe | 1:bcb384b83f54 | 212 | lights.setRGBPixels1(gr); |
el12moe | 1:bcb384b83f54 | 213 | wait(1); |
el12moe | 1:bcb384b83f54 | 214 | lights.setRGBPixels1(rg); |
el12moe | 1:bcb384b83f54 | 215 | wait(1); |
el12moe | 1:bcb384b83f54 | 216 | lights.setRGBPixels1(gr); |
el12moe | 1:bcb384b83f54 | 217 | wait(1); |
el12moe | 1:bcb384b83f54 | 218 | lights.setRGBStrip1(255, 0, 0); |
el12moe | 1:bcb384b83f54 | 219 | wait(1); |
el12moe | 1:bcb384b83f54 | 220 | lights.setRGBStrip1(0,255,0); |
el12moe | 1:bcb384b83f54 | 221 | wait(1); |
el12moe | 0:3f93f42809e5 | 222 | } |
el12moe | 0:3f93f42809e5 | 223 | void hunika(void){ |
el12moe | 1:bcb384b83f54 | 224 | lights.setRGBPixels1(bw); |
el12moe | 1:bcb384b83f54 | 225 | wait(1); |
el12moe | 1:bcb384b83f54 | 226 | lights.setRGBPixels1(wb); |
el12moe | 1:bcb384b83f54 | 227 | wait(1); |
el12moe | 1:bcb384b83f54 | 228 | lights.setRGBPixels1(bw); |
el12moe | 1:bcb384b83f54 | 229 | wait(1); |
el12moe | 1:bcb384b83f54 | 230 | lights.setRGBPixels1(wb); |
el12moe | 1:bcb384b83f54 | 231 | wait(1); |
el12moe | 1:bcb384b83f54 | 232 | lights.setRGBPixels1(bw); |
el12moe | 1:bcb384b83f54 | 233 | wait(1); |
el12moe | 1:bcb384b83f54 | 234 | lights.setRGBPixels1(wb); |
el12moe | 1:bcb384b83f54 | 235 | wait(1); |
el12moe | 1:bcb384b83f54 | 236 | lights.setRGBPixels1(bw); |
el12moe | 1:bcb384b83f54 | 237 | wait(1); |
el12moe | 1:bcb384b83f54 | 238 | lights.setRGBPixels1(wb); |
el12moe | 1:bcb384b83f54 | 239 | wait(1); |
el12moe | 1:bcb384b83f54 | 240 | lights.setRGBPixels1(bw); |
el12moe | 1:bcb384b83f54 | 241 | wait(1); |
el12moe | 1:bcb384b83f54 | 242 | lights.setRGBPixels1(wb); |
el12moe | 1:bcb384b83f54 | 243 | wait(1); |
el12moe | 1:bcb384b83f54 | 244 | lights.setRGBStrip1(0, 0, 255); |
el12moe | 1:bcb384b83f54 | 245 | wait(1); |
el12moe | 1:bcb384b83f54 | 246 | lights.setRGBStrip1(255,255,255); |
el12moe | 1:bcb384b83f54 | 247 | wait(1); |
el12moe | 0:3f93f42809e5 | 248 | } |
el12moe | 1:bcb384b83f54 | 249 | |
el12moe | 0:3f93f42809e5 | 250 | void akwansa(void){ |
el12moe | 1:bcb384b83f54 | 251 | lights.setRGBPixels1(ak1); |
el12moe | 1:bcb384b83f54 | 252 | wait(1); |
el12moe | 1:bcb384b83f54 | 253 | lights.setRGBPixels1(ak2); |
el12moe | 1:bcb384b83f54 | 254 | wait(1); |
el12moe | 1:bcb384b83f54 | 255 | lights.setRGBPixels1(ak3); |
el12moe | 1:bcb384b83f54 | 256 | wait(1); |
el12moe | 1:bcb384b83f54 | 257 | lights.setRGBPixels1(ak4); |
el12moe | 1:bcb384b83f54 | 258 | wait(1); |
el12moe | 1:bcb384b83f54 | 259 | lights.setRGBPixels1(ak1); |
el12moe | 1:bcb384b83f54 | 260 | wait(1); |
el12moe | 1:bcb384b83f54 | 261 | lights.setRGBPixels1(ak2); |
el12moe | 1:bcb384b83f54 | 262 | wait(1); |
el12moe | 1:bcb384b83f54 | 263 | lights.setRGBPixels1(ak3); |
el12moe | 1:bcb384b83f54 | 264 | wait(1); |
el12moe | 1:bcb384b83f54 | 265 | lights.setRGBPixels1(ak4); |
el12moe | 1:bcb384b83f54 | 266 | wait(1); |
el12moe | 1:bcb384b83f54 | 267 | lights.setRGBPixels1(ak1); |
el12moe | 1:bcb384b83f54 | 268 | wait(1); |
el12moe | 1:bcb384b83f54 | 269 | lights.setRGBPixels1(ak2); |
el12moe | 1:bcb384b83f54 | 270 | wait(1); |
el12moe | 1:bcb384b83f54 | 271 | lights.setRGBPixels1(ak3); |
el12moe | 1:bcb384b83f54 | 272 | wait(1); |
el12moe | 1:bcb384b83f54 | 273 | lights.setRGBPixels1(ak4); |
el12moe | 1:bcb384b83f54 | 274 | wait(1); |
el12moe | 0:3f93f42809e5 | 275 | } |
el12moe | 0:3f93f42809e5 | 276 | void rainbow(void){ |
el12moe | 1:bcb384b83f54 | 277 | lights.setRGBPixels1(ra1); |
el12moe | 1:bcb384b83f54 | 278 | wait(1); |
el12moe | 1:bcb384b83f54 | 279 | lights.setRGBPixels1(ra2); |
el12moe | 1:bcb384b83f54 | 280 | wait(1); |
el12moe | 1:bcb384b83f54 | 281 | lights.setRGBPixels1(ra3); |
el12moe | 1:bcb384b83f54 | 282 | wait(1); |
el12moe | 1:bcb384b83f54 | 283 | lights.setRGBPixels1(ra4); |
el12moe | 1:bcb384b83f54 | 284 | wait(1); |
el12moe | 1:bcb384b83f54 | 285 | lights.setRGBPixels1(ra5); |
el12moe | 1:bcb384b83f54 | 286 | wait(1); |
el12moe | 1:bcb384b83f54 | 287 | lights.setRGBPixels1(ra6); |
el12moe | 1:bcb384b83f54 | 288 | wait(1); |
el12moe | 1:bcb384b83f54 | 289 | lights.setRGBPixels1(ra7); |
el12moe | 1:bcb384b83f54 | 290 | wait(1); |
el12moe | 1:bcb384b83f54 | 291 | lights.setRGBPixels1(ra8); |
el12moe | 1:bcb384b83f54 | 292 | wait(1); |
el12moe | 0:3f93f42809e5 | 293 | } |
el12moe | 0:3f93f42809e5 | 294 | |
el12moe | 1:bcb384b83f54 | 295 | void rgbm(void){ |
el12moe | 1:bcb384b83f54 | 296 | lights.setRGBPixels2(rgb); |
el12moe | 1:bcb384b83f54 | 297 | wait(1); |
el12moe | 1:bcb384b83f54 | 298 | lights.setRGBPixels2(brg); |
el12moe | 1:bcb384b83f54 | 299 | wait(1); |
el12moe | 1:bcb384b83f54 | 300 | lights.setRGBPixels2(gbr); |
el12moe | 1:bcb384b83f54 | 301 | wait(1); |
el12moe | 1:bcb384b83f54 | 302 | lights.setRGBPixels2(bgr); |
el12moe | 1:bcb384b83f54 | 303 | wait(1); |
el12moe | 1:bcb384b83f54 | 304 | lights.setRGBPixels2(rgb); |
el12moe | 1:bcb384b83f54 | 305 | wait(1); |
el12moe | 1:bcb384b83f54 | 306 | lights.setRGBPixels2(brg); |
el12moe | 1:bcb384b83f54 | 307 | wait(1); |
el12moe | 1:bcb384b83f54 | 308 | lights.setRGBPixels2(gbr); |
el12moe | 1:bcb384b83f54 | 309 | wait(1); |
el12moe | 1:bcb384b83f54 | 310 | lights.setRGBPixels2(bgr); |
el12moe | 1:bcb384b83f54 | 311 | wait(1); |
el12moe | 1:bcb384b83f54 | 312 | lights.setRGBPixels2(rgb); |
el12moe | 1:bcb384b83f54 | 313 | wait(1); |
el12moe | 1:bcb384b83f54 | 314 | lights.setRGBPixels2(brg); |
el12moe | 1:bcb384b83f54 | 315 | wait(1); |
el12moe | 1:bcb384b83f54 | 316 | lights.setRGBPixels2(gbr); |
el12moe | 1:bcb384b83f54 | 317 | wait(1); |
el12moe | 1:bcb384b83f54 | 318 | lights.setRGBPixels2(bgr); |
el12moe | 1:bcb384b83f54 | 319 | wait(1); |
el12moe | 1:bcb384b83f54 | 320 | lights.setRGBStrip2(255, 0, 0); |
el12moe | 1:bcb384b83f54 | 321 | wait(1); |
el12moe | 1:bcb384b83f54 | 322 | lights.setRGBStrip2(0,255,0); |
el12moe | 1:bcb384b83f54 | 323 | wait(1); |
el12moe | 1:bcb384b83f54 | 324 | lights.setRGBStrip2(0,0,255); |
el12moe | 1:bcb384b83f54 | 325 | wait(1); |
el12moe | 0:3f93f42809e5 | 326 | } |
el12moe | 1:bcb384b83f54 | 327 | |
el12moe | 1:bcb384b83f54 | 328 | void christmas2(void){ |
el12moe | 1:bcb384b83f54 | 329 | lights.setRGBPixels2(rg); |
el12moe | 1:bcb384b83f54 | 330 | wait(1); |
el12moe | 1:bcb384b83f54 | 331 | lights.setRGBPixels2(gr); |
el12moe | 1:bcb384b83f54 | 332 | wait(1); |
el12moe | 1:bcb384b83f54 | 333 | lights.setRGBPixels2(rg); |
el12moe | 1:bcb384b83f54 | 334 | wait(1); |
el12moe | 1:bcb384b83f54 | 335 | lights.setRGBPixels2(gr); |
el12moe | 1:bcb384b83f54 | 336 | wait(1); |
el12moe | 1:bcb384b83f54 | 337 | lights.setRGBPixels2(rg); |
el12moe | 1:bcb384b83f54 | 338 | wait(1); |
el12moe | 1:bcb384b83f54 | 339 | lights.setRGBPixels2(gr); |
el12moe | 1:bcb384b83f54 | 340 | wait(1); |
el12moe | 1:bcb384b83f54 | 341 | lights.setRGBPixels2(rg); |
el12moe | 1:bcb384b83f54 | 342 | wait(1); |
el12moe | 1:bcb384b83f54 | 343 | lights.setRGBPixels2(gr); |
el12moe | 1:bcb384b83f54 | 344 | wait(1); |
el12moe | 1:bcb384b83f54 | 345 | lights.setRGBPixels2(rg); |
el12moe | 1:bcb384b83f54 | 346 | wait(1); |
el12moe | 1:bcb384b83f54 | 347 | lights.setRGBPixels2(gr); |
el12moe | 1:bcb384b83f54 | 348 | wait(1); |
el12moe | 1:bcb384b83f54 | 349 | lights.setRGBStrip2(255, 0, 0); |
el12moe | 1:bcb384b83f54 | 350 | wait(1); |
el12moe | 1:bcb384b83f54 | 351 | lights.setRGBStrip2(0,255,0); |
el12moe | 1:bcb384b83f54 | 352 | wait(1); |
el12moe | 1:bcb384b83f54 | 353 | } |
el12moe | 0:3f93f42809e5 | 354 | |
el12moe | 1:bcb384b83f54 | 355 | void hunika2(void){ |
el12moe | 1:bcb384b83f54 | 356 | lights.setRGBPixels2(bw); |
el12moe | 1:bcb384b83f54 | 357 | wait(1); |
el12moe | 1:bcb384b83f54 | 358 | lights.setRGBPixels2(wb); |
el12moe | 1:bcb384b83f54 | 359 | wait(1); |
el12moe | 1:bcb384b83f54 | 360 | lights.setRGBPixels2(bw); |
el12moe | 1:bcb384b83f54 | 361 | wait(1); |
el12moe | 1:bcb384b83f54 | 362 | lights.setRGBPixels2(wb); |
el12moe | 1:bcb384b83f54 | 363 | wait(1); |
el12moe | 1:bcb384b83f54 | 364 | lights.setRGBPixels2(bw); |
el12moe | 1:bcb384b83f54 | 365 | wait(1); |
el12moe | 1:bcb384b83f54 | 366 | lights.setRGBPixels2(wb); |
el12moe | 1:bcb384b83f54 | 367 | wait(1); |
el12moe | 1:bcb384b83f54 | 368 | lights.setRGBPixels2(bw); |
el12moe | 1:bcb384b83f54 | 369 | wait(1); |
el12moe | 1:bcb384b83f54 | 370 | lights.setRGBPixels2(wb); |
el12moe | 1:bcb384b83f54 | 371 | wait(1); |
el12moe | 1:bcb384b83f54 | 372 | lights.setRGBPixels2(bw); |
el12moe | 1:bcb384b83f54 | 373 | wait(1); |
el12moe | 1:bcb384b83f54 | 374 | lights.setRGBPixels2(wb); |
el12moe | 1:bcb384b83f54 | 375 | wait(1); |
el12moe | 1:bcb384b83f54 | 376 | lights.setRGBStrip2(0, 0, 255); |
el12moe | 1:bcb384b83f54 | 377 | wait(1); |
el12moe | 1:bcb384b83f54 | 378 | lights.setRGBStrip2(255,255,255); |
el12moe | 1:bcb384b83f54 | 379 | wait(1); |
el12moe | 0:3f93f42809e5 | 380 | } |
el12moe | 1:bcb384b83f54 | 381 | |
el12moe | 0:3f93f42809e5 | 382 | void akwansa2(void){ |
el12moe | 1:bcb384b83f54 | 383 | lights.setRGBPixels2(ak1); |
el12moe | 1:bcb384b83f54 | 384 | wait(1); |
el12moe | 1:bcb384b83f54 | 385 | lights.setRGBPixels2(ak2); |
el12moe | 1:bcb384b83f54 | 386 | wait(1); |
el12moe | 1:bcb384b83f54 | 387 | lights.setRGBPixels2(ak3); |
el12moe | 1:bcb384b83f54 | 388 | wait(1); |
el12moe | 1:bcb384b83f54 | 389 | lights.setRGBPixels2(ak4); |
el12moe | 1:bcb384b83f54 | 390 | wait(1); |
el12moe | 1:bcb384b83f54 | 391 | lights.setRGBPixels2(ak1); |
el12moe | 1:bcb384b83f54 | 392 | wait(1); |
el12moe | 1:bcb384b83f54 | 393 | lights.setRGBPixels2(ak2); |
el12moe | 1:bcb384b83f54 | 394 | wait(1); |
el12moe | 1:bcb384b83f54 | 395 | lights.setRGBPixels2(ak3); |
el12moe | 1:bcb384b83f54 | 396 | wait(1); |
el12moe | 1:bcb384b83f54 | 397 | lights.setRGBPixels2(ak4); |
el12moe | 1:bcb384b83f54 | 398 | wait(1); |
el12moe | 1:bcb384b83f54 | 399 | lights.setRGBPixels2(ak1); |
el12moe | 1:bcb384b83f54 | 400 | wait(1); |
el12moe | 1:bcb384b83f54 | 401 | lights.setRGBPixels2(ak2); |
el12moe | 1:bcb384b83f54 | 402 | wait(1); |
el12moe | 1:bcb384b83f54 | 403 | lights.setRGBPixels2(ak3); |
el12moe | 1:bcb384b83f54 | 404 | wait(1); |
el12moe | 1:bcb384b83f54 | 405 | lights.setRGBPixels2(ak4); |
el12moe | 1:bcb384b83f54 | 406 | wait(1); |
el12moe | 1:bcb384b83f54 | 407 | } |
el12moe | 0:3f93f42809e5 | 408 | |
el12moe | 1:bcb384b83f54 | 409 | |
el12moe | 0:3f93f42809e5 | 410 | void rainbow2(void){ |
el12moe | 1:bcb384b83f54 | 411 | lights.setRGBPixels2(ra1); |
el12moe | 1:bcb384b83f54 | 412 | wait(1); |
el12moe | 1:bcb384b83f54 | 413 | lights.setRGBPixels2(ra2); |
el12moe | 1:bcb384b83f54 | 414 | wait(1); |
el12moe | 1:bcb384b83f54 | 415 | lights.setRGBPixels2(ra3); |
el12moe | 1:bcb384b83f54 | 416 | wait(1); |
el12moe | 1:bcb384b83f54 | 417 | lights.setRGBPixels2(ra4); |
el12moe | 1:bcb384b83f54 | 418 | wait(1); |
el12moe | 1:bcb384b83f54 | 419 | lights.setRGBPixels2(ra5); |
el12moe | 1:bcb384b83f54 | 420 | wait(1); |
el12moe | 1:bcb384b83f54 | 421 | lights.setRGBPixels2(ra6); |
el12moe | 1:bcb384b83f54 | 422 | wait(1); |
el12moe | 1:bcb384b83f54 | 423 | lights.setRGBPixels2(ra7); |
el12moe | 1:bcb384b83f54 | 424 | wait(1); |
el12moe | 1:bcb384b83f54 | 425 | lights.setRGBPixels2(ra8); |
el12moe | 1:bcb384b83f54 | 426 | wait(1); |
el12moe | 0:3f93f42809e5 | 427 | } |
el12moe | 1:bcb384b83f54 | 428 | |
el12moe | 0:3f93f42809e5 | 429 | |
el12moe | 1:bcb384b83f54 | 430 | void rgbm2(void){ |
el12moe | 1:bcb384b83f54 | 431 | lights.setRGBPixels2(rgb); |
el12moe | 1:bcb384b83f54 | 432 | wait(1); |
el12moe | 1:bcb384b83f54 | 433 | lights.setRGBPixels2(brg); |
el12moe | 1:bcb384b83f54 | 434 | wait(1); |
el12moe | 1:bcb384b83f54 | 435 | lights.setRGBPixels2(gbr); |
el12moe | 1:bcb384b83f54 | 436 | wait(1); |
el12moe | 1:bcb384b83f54 | 437 | lights.setRGBPixels2(bgr); |
el12moe | 1:bcb384b83f54 | 438 | wait(1); |
el12moe | 1:bcb384b83f54 | 439 | lights.setRGBPixels2(rgb); |
el12moe | 1:bcb384b83f54 | 440 | wait(1); |
el12moe | 1:bcb384b83f54 | 441 | lights.setRGBPixels2(brg); |
el12moe | 1:bcb384b83f54 | 442 | wait(1); |
el12moe | 1:bcb384b83f54 | 443 | lights.setRGBPixels2(gbr); |
el12moe | 1:bcb384b83f54 | 444 | wait(1); |
el12moe | 1:bcb384b83f54 | 445 | lights.setRGBPixels2(bgr); |
el12moe | 1:bcb384b83f54 | 446 | wait(1); |
el12moe | 1:bcb384b83f54 | 447 | lights.setRGBPixels2(rgb); |
el12moe | 1:bcb384b83f54 | 448 | wait(1); |
el12moe | 1:bcb384b83f54 | 449 | lights.setRGBPixels2(brg); |
el12moe | 1:bcb384b83f54 | 450 | wait(1); |
el12moe | 1:bcb384b83f54 | 451 | lights.setRGBPixels2(gbr); |
el12moe | 1:bcb384b83f54 | 452 | wait(1); |
el12moe | 1:bcb384b83f54 | 453 | lights.setRGBPixels2(bgr); |
el12moe | 1:bcb384b83f54 | 454 | wait(1); |
el12moe | 1:bcb384b83f54 | 455 | lights.setRGBStrip2(255, 0, 0); |
el12moe | 1:bcb384b83f54 | 456 | wait(1); |
el12moe | 1:bcb384b83f54 | 457 | lights.setRGBStrip2(0,255,0); |
el12moe | 1:bcb384b83f54 | 458 | wait(1); |
el12moe | 1:bcb384b83f54 | 459 | lights.setRGBStrip2(0,0,255); |
el12moe | 1:bcb384b83f54 | 460 | wait(1); |
el12moe | 0:3f93f42809e5 | 461 | } |