123

Dependencies:   WS2812 PixelArray DebounceIn

Committer:
turumputum
Date:
Thu Jul 02 10:33:57 2020 +0000
Revision:
1:af17c65e86dc
Parent:
0:ea88f8c194d2
233

Who changed what in which revision?

UserRevisionLine numberNew contents of line
turumputum 0:ea88f8c194d2 1 #include "mbed.h"
turumputum 0:ea88f8c194d2 2
turumputum 0:ea88f8c194d2 3 #include "main.h"
turumputum 0:ea88f8c194d2 4
turumputum 0:ea88f8c194d2 5 //#include "PixelArray.h"
turumputum 0:ea88f8c194d2 6 //#include "WS2812.h"
turumputum 0:ea88f8c194d2 7
turumputum 0:ea88f8c194d2 8
turumputum 0:ea88f8c194d2 9
turumputum 0:ea88f8c194d2 10
turumputum 0:ea88f8c194d2 11 //_____________Parametrs_______________
turumputum 0:ea88f8c194d2 12 #define dogIdleCount 20000
turumputum 0:ea88f8c194d2 13
turumputum 0:ea88f8c194d2 14 #define verbose 1
turumputum 0:ea88f8c194d2 15
turumputum 1:af17c65e86dc 16 #define LED_ON_BRIGHT 50
turumputum 1:af17c65e86dc 17 #define LED_BLINK_PERIOD 100
turumputum 1:af17c65e86dc 18 #define LedWaitK 0
turumputum 1:af17c65e86dc 19 #define LedOnK 50
turumputum 1:af17c65e86dc 20 #define blinkBright 50
turumputum 0:ea88f8c194d2 21
turumputum 0:ea88f8c194d2 22
turumputum 0:ea88f8c194d2 23
turumputum 0:ea88f8c194d2 24 //_____________Variebles_______________
turumputum 0:ea88f8c194d2 25
turumputum 0:ea88f8c194d2 26 uint8_t gameState;
turumputum 0:ea88f8c194d2 27
turumputum 0:ea88f8c194d2 28 int report;
turumputum 0:ea88f8c194d2 29 int gameDog=0;
turumputum 0:ea88f8c194d2 30 int plasedSum = 0;//количество правильно положенных элементов
turumputum 0:ea88f8c194d2 31 int k;
turumputum 0:ea88f8c194d2 32 bool GameComplete=0;
turumputum 0:ea88f8c194d2 33 float tS,tM,tI;
turumputum 1:af17c65e86dc 34 int sleepMode;
turumputum 0:ea88f8c194d2 35
turumputum 0:ea88f8c194d2 36
turumputum 0:ea88f8c194d2 37
turumputum 0:ea88f8c194d2 38
turumputum 0:ea88f8c194d2 39 int color_set(uint8_t red,uint8_t green, uint8_t blue)
turumputum 0:ea88f8c194d2 40 {
turumputum 0:ea88f8c194d2 41 return ((red<<16) + (green<<8) + blue);
turumputum 0:ea88f8c194d2 42 }
turumputum 0:ea88f8c194d2 43
turumputum 0:ea88f8c194d2 44
turumputum 0:ea88f8c194d2 45 //_________________________CLASSES___________________
turumputum 0:ea88f8c194d2 46
turumputum 0:ea88f8c194d2 47 LedGroupInside::LedGroupInside(PinName pin, int placeInTable, int size): __pa(size), __leds(pin, size, T0H, T0L, T1H, T1L)
turumputum 0:ea88f8c194d2 48 {
turumputum 0:ea88f8c194d2 49 __placeInTable = placeInTable;
turumputum 0:ea88f8c194d2 50 __size = size;
turumputum 0:ea88f8c194d2 51 //PixelArray __pa(size);
turumputum 0:ea88f8c194d2 52 //WS2812 __leds(pin, __size, T0H, T0L, T1H, T1L);
turumputum 0:ea88f8c194d2 53 }
turumputum 0:ea88f8c194d2 54
turumputum 0:ea88f8c194d2 55 void LedGroupInside::light(int mode)
turumputum 0:ea88f8c194d2 56 {
turumputum 0:ea88f8c194d2 57 int R,G,B;
turumputum 0:ea88f8c194d2 58
turumputum 0:ea88f8c194d2 59 switch (mode) {
turumputum 0:ea88f8c194d2 60 case LedWait:
turumputum 0:ea88f8c194d2 61
turumputum 0:ea88f8c194d2 62
turumputum 0:ea88f8c194d2 63 if(tableState[3][__placeInTable]!=LedWaitK) {
turumputum 0:ea88f8c194d2 64 if(tableState[3][__placeInTable]<LedWaitK) {
turumputum 0:ea88f8c194d2 65 tableState[3][__placeInTable]++;
turumputum 0:ea88f8c194d2 66 } else if (tableState[3][__placeInTable]>LedWaitK) {
turumputum 0:ea88f8c194d2 67 tableState[3][__placeInTable]--;
turumputum 0:ea88f8c194d2 68 }
turumputum 1:af17c65e86dc 69 __pa.SetAll(color_set(0,0,0));
turumputum 0:ea88f8c194d2 70 __leds.write(__pa.getBuf());
turumputum 0:ea88f8c194d2 71 }
turumputum 0:ea88f8c194d2 72 break;
turumputum 0:ea88f8c194d2 73
turumputum 0:ea88f8c194d2 74 case LedOn:
turumputum 0:ea88f8c194d2 75
turumputum 0:ea88f8c194d2 76
turumputum 1:af17c65e86dc 77 if((tableState[3][__placeInTable]!=LedOnK)||(sleepMode==1)) {
turumputum 0:ea88f8c194d2 78 if(tableState[3][__placeInTable]<LedOnK) {
turumputum 0:ea88f8c194d2 79 tableState[3][__placeInTable]++;
turumputum 0:ea88f8c194d2 80 } else if (tableState[3][__placeInTable]>LedOnK) {
turumputum 0:ea88f8c194d2 81 tableState[3][__placeInTable]--;
turumputum 0:ea88f8c194d2 82 }
turumputum 1:af17c65e86dc 83 int Bright = tableState[3][__placeInTable];
turumputum 1:af17c65e86dc 84
turumputum 1:af17c65e86dc 85 R=0;
turumputum 1:af17c65e86dc 86 G=LED_ON_BRIGHT*Bright/100;
turumputum 1:af17c65e86dc 87 B=0;
turumputum 0:ea88f8c194d2 88
turumputum 1:af17c65e86dc 89 if(sleepMode==0) {
turumputum 1:af17c65e86dc 90 __pa.SetAll(color_set(R,G,B));
turumputum 1:af17c65e86dc 91 __leds.write(__pa.getBuf());
turumputum 1:af17c65e86dc 92 } else {
turumputum 1:af17c65e86dc 93 __pa.SetAll(color_set(0,0,0));
turumputum 1:af17c65e86dc 94 __leds.write(__pa.getBuf());
turumputum 1:af17c65e86dc 95 }
turumputum 0:ea88f8c194d2 96 }
turumputum 0:ea88f8c194d2 97 break;
turumputum 0:ea88f8c194d2 98
turumputum 0:ea88f8c194d2 99 case LedOff:
turumputum 0:ea88f8c194d2 100 __pa.SetAll(color_set(0,0,0));
turumputum 0:ea88f8c194d2 101 __leds.write(__pa.getBuf());
turumputum 0:ea88f8c194d2 102 break;
turumputum 0:ea88f8c194d2 103
turumputum 0:ea88f8c194d2 104 case LedBlink:
turumputum 1:af17c65e86dc 105 if((tableState[3][__placeInTable]!=LedOnK)||(sleepMode==1)) {
turumputum 1:af17c65e86dc 106 if(tableState[3][__placeInTable]<LedOnK) {
turumputum 1:af17c65e86dc 107 tableState[3][__placeInTable]++;
turumputum 1:af17c65e86dc 108 } else if (tableState[3][__placeInTable]>LedOnK) {
turumputum 1:af17c65e86dc 109 tableState[3][__placeInTable]--;
turumputum 1:af17c65e86dc 110 }
turumputum 1:af17c65e86dc 111 int Bright = tableState[3][__placeInTable];
turumputum 1:af17c65e86dc 112
turumputum 1:af17c65e86dc 113 R=LED_ON_BRIGHT*Bright/100;
turumputum 1:af17c65e86dc 114 G=0;
turumputum 1:af17c65e86dc 115 B=0;
turumputum 1:af17c65e86dc 116 if(sleepMode==0) {
turumputum 1:af17c65e86dc 117 __pa.SetAll(color_set(R,G,B));
turumputum 1:af17c65e86dc 118 __leds.write(__pa.getBuf());
turumputum 1:af17c65e86dc 119 } else {
turumputum 1:af17c65e86dc 120 __pa.SetAll(color_set(0,0,0));
turumputum 1:af17c65e86dc 121 __leds.write(__pa.getBuf());
turumputum 1:af17c65e86dc 122 }
turumputum 1:af17c65e86dc 123 }
turumputum 1:af17c65e86dc 124 break;
turumputum 1:af17c65e86dc 125
turumputum 1:af17c65e86dc 126 case LedRun:
turumputum 0:ea88f8c194d2 127 if(gameState!=idle) {
turumputum 1:af17c65e86dc 128 if(tableState[3][__placeInTable]<LED_BLINK_PERIOD) {
turumputum 0:ea88f8c194d2 129 tableState[3][__placeInTable]++;
turumputum 0:ea88f8c194d2 130 } else {
turumputum 0:ea88f8c194d2 131 tableState[3][__placeInTable]=0;
turumputum 0:ea88f8c194d2 132 }
turumputum 0:ea88f8c194d2 133
turumputum 0:ea88f8c194d2 134 float blinkVal=0;
turumputum 0:ea88f8c194d2 135
turumputum 1:af17c65e86dc 136 blinkVal =0.5 + sin((6.28/LED_BLINK_PERIOD)*tableState[3][__placeInTable])/2;
turumputum 0:ea88f8c194d2 137 //pc.printf("blinkVal %f \n", blinkVal);
turumputum 1:af17c65e86dc 138 if(sleepMode==0) {
turumputum 1:af17c65e86dc 139 __pa.SetAll(color_set(0,blinkBright*blinkVal,0));
turumputum 1:af17c65e86dc 140 __leds.write(__pa.getBuf());
turumputum 1:af17c65e86dc 141 } else {
turumputum 1:af17c65e86dc 142 __pa.SetAll(color_set(0,0,0));
turumputum 1:af17c65e86dc 143 __leds.write(__pa.getBuf());
turumputum 1:af17c65e86dc 144 }
turumputum 0:ea88f8c194d2 145 }
turumputum 0:ea88f8c194d2 146 break;
turumputum 0:ea88f8c194d2 147 }
turumputum 0:ea88f8c194d2 148 }
turumputum 0:ea88f8c194d2 149
turumputum 0:ea88f8c194d2 150
turumputum 0:ea88f8c194d2 151 LedGroupStenka::LedGroupStenka(int placeInTable,int type, int sp1, int size1, int sp2, int size2)
turumputum 0:ea88f8c194d2 152 {
turumputum 0:ea88f8c194d2 153 __type=type;
turumputum 0:ea88f8c194d2 154 __sp1=sp1;
turumputum 0:ea88f8c194d2 155 __size1=size1;
turumputum 0:ea88f8c194d2 156 __sp2=sp2;
turumputum 0:ea88f8c194d2 157 __size2=size2;
turumputum 0:ea88f8c194d2 158 __placeInTable = placeInTable;
turumputum 0:ea88f8c194d2 159 //PixelArray __pa(size);
turumputum 0:ea88f8c194d2 160 //WS2812 __leds(pin, __size, T0H, T0L, T1H, T1L);
turumputum 0:ea88f8c194d2 161 }
turumputum 0:ea88f8c194d2 162
turumputum 0:ea88f8c194d2 163
turumputum 0:ea88f8c194d2 164
turumputum 0:ea88f8c194d2 165 //______________________________________
turumputum 0:ea88f8c194d2 166 void LedGroupStenka::light(int mode)
turumputum 0:ea88f8c194d2 167 {
turumputum 0:ea88f8c194d2 168
turumputum 0:ea88f8c194d2 169 int R,G,B;
turumputum 0:ea88f8c194d2 170
turumputum 0:ea88f8c194d2 171 switch (mode) {
turumputum 0:ea88f8c194d2 172 case LedWait://_______________________________________________________________________________________________________________________________
turumputum 0:ea88f8c194d2 173
turumputum 0:ea88f8c194d2 174
turumputum 0:ea88f8c194d2 175 if(tableState[3][__placeInTable]!=LedWaitK) {
turumputum 0:ea88f8c194d2 176
turumputum 0:ea88f8c194d2 177 if(tableState[3][__placeInTable]<LedWaitK) {
turumputum 0:ea88f8c194d2 178 tableState[3][__placeInTable]+=1;
turumputum 0:ea88f8c194d2 179 } else if (tableState[3][__placeInTable]>LedWaitK) {
turumputum 0:ea88f8c194d2 180 tableState[3][__placeInTable]-=1;
turumputum 0:ea88f8c194d2 181 }
turumputum 0:ea88f8c194d2 182
turumputum 1:af17c65e86dc 183 writeLed(__type,0,0,0);
turumputum 0:ea88f8c194d2 184 }
turumputum 0:ea88f8c194d2 185 break;
turumputum 0:ea88f8c194d2 186
turumputum 0:ea88f8c194d2 187 case LedOn://_______________________________________________________________________________________________________________________________
turumputum 1:af17c65e86dc 188 if((tableState[3][__placeInTable]!=LedOnK)||(sleepMode==1)) {
turumputum 0:ea88f8c194d2 189 if(tableState[3][__placeInTable]<LedOnK) {
turumputum 0:ea88f8c194d2 190 tableState[3][__placeInTable]+=2;
turumputum 0:ea88f8c194d2 191 } else if (tableState[3][__placeInTable]>LedOnK) {
turumputum 0:ea88f8c194d2 192 tableState[3][__placeInTable]-=2;
turumputum 0:ea88f8c194d2 193 }
turumputum 0:ea88f8c194d2 194
turumputum 0:ea88f8c194d2 195 int Bright = tableState[3][__placeInTable];
turumputum 0:ea88f8c194d2 196
turumputum 1:af17c65e86dc 197 R=0;
turumputum 1:af17c65e86dc 198 G=LED_ON_BRIGHT*Bright/100;
turumputum 1:af17c65e86dc 199 B=0;
turumputum 1:af17c65e86dc 200 if(sleepMode==0) {
turumputum 1:af17c65e86dc 201 writeLed(__type,R,G,B);
turumputum 1:af17c65e86dc 202 } else {
turumputum 1:af17c65e86dc 203 writeLed(__type,0,0,0);
turumputum 1:af17c65e86dc 204 }
turumputum 0:ea88f8c194d2 205 }
turumputum 0:ea88f8c194d2 206 break;
turumputum 0:ea88f8c194d2 207
turumputum 0:ea88f8c194d2 208 case LedOff:
turumputum 0:ea88f8c194d2 209 writeLed(__type,0,0,0);
turumputum 0:ea88f8c194d2 210 break;
turumputum 0:ea88f8c194d2 211
turumputum 0:ea88f8c194d2 212 case LedBlink://_____________________________________________________________________________________________________________
turumputum 1:af17c65e86dc 213 if((tableState[3][__placeInTable]!=LedOnK)||(sleepMode==1)) {
turumputum 1:af17c65e86dc 214 if(tableState[3][__placeInTable]<LedOnK) {
turumputum 1:af17c65e86dc 215 tableState[3][__placeInTable]+=2;
turumputum 1:af17c65e86dc 216 } else if (tableState[3][__placeInTable]>LedOnK) {
turumputum 1:af17c65e86dc 217 tableState[3][__placeInTable]-=2;
turumputum 1:af17c65e86dc 218 }
turumputum 1:af17c65e86dc 219
turumputum 1:af17c65e86dc 220 int Bright = tableState[3][__placeInTable];
turumputum 1:af17c65e86dc 221
turumputum 1:af17c65e86dc 222 R=LED_ON_BRIGHT*Bright/100;
turumputum 1:af17c65e86dc 223 G=0;
turumputum 1:af17c65e86dc 224 B=0;
turumputum 1:af17c65e86dc 225 if(sleepMode==0) {
turumputum 1:af17c65e86dc 226 writeLed(__type,R,G,B);
turumputum 1:af17c65e86dc 227 } else {
turumputum 1:af17c65e86dc 228 writeLed(__type,0,0,0);
turumputum 1:af17c65e86dc 229 }
turumputum 1:af17c65e86dc 230 }
turumputum 1:af17c65e86dc 231 break;
turumputum 1:af17c65e86dc 232
turumputum 1:af17c65e86dc 233 case LedRun://________________________________________________________________________________________________________________________________________
turumputum 1:af17c65e86dc 234
turumputum 0:ea88f8c194d2 235 if(gameState!=idle) {
turumputum 1:af17c65e86dc 236 if(tableState[3][__placeInTable]<LED_BLINK_PERIOD) {
turumputum 0:ea88f8c194d2 237 tableState[3][__placeInTable]++;
turumputum 0:ea88f8c194d2 238 } else {
turumputum 0:ea88f8c194d2 239 tableState[3][__placeInTable]=0;
turumputum 0:ea88f8c194d2 240 }
turumputum 0:ea88f8c194d2 241
turumputum 0:ea88f8c194d2 242 float blinkVal=0;
turumputum 1:af17c65e86dc 243 blinkVal = 0.5 + sin((6.28/LED_BLINK_PERIOD)*tableState[3][__placeInTable])/2;
turumputum 0:ea88f8c194d2 244
turumputum 1:af17c65e86dc 245 if(sleepMode==0) {
turumputum 1:af17c65e86dc 246 writeLed(__type,0,blinkBright*blinkVal,0);
turumputum 1:af17c65e86dc 247 } else {
turumputum 1:af17c65e86dc 248 writeLed(__type,0,0,0);
turumputum 1:af17c65e86dc 249 }
turumputum 0:ea88f8c194d2 250
turumputum 1:af17c65e86dc 251 //setStaticValToLed(__type,__sp1, __size1, __sp2, __size2, blinkBright*blinkVal,0,0);
turumputum 0:ea88f8c194d2 252 }
turumputum 0:ea88f8c194d2 253 break;
turumputum 0:ea88f8c194d2 254 }
turumputum 0:ea88f8c194d2 255 }
turumputum 0:ea88f8c194d2 256
turumputum 0:ea88f8c194d2 257
turumputum 0:ea88f8c194d2 258
turumputum 0:ea88f8c194d2 259 void LedGroupStenka::writeLed(int type, uint8_t r, uint8_t g, uint8_t b)
turumputum 0:ea88f8c194d2 260 {
turumputum 0:ea88f8c194d2 261
turumputum 0:ea88f8c194d2 262 //pc.printf("type: %d R %d G %d B %d \n",type,r,g,b);
turumputum 0:ea88f8c194d2 263 //pc.printf("__sp1: %d __size1 %d __sp2: %d __size2 %d \n",__sp1,__size1,__sp2, __size2);
turumputum 0:ea88f8c194d2 264
turumputum 0:ea88f8c194d2 265 if(type==0) { //нормальная мембрана
turumputum 0:ea88f8c194d2 266 for(int t=__sp2; t<(__sp2+__size2); t++) {
turumputum 0:ea88f8c194d2 267 pa_stenkaLed_2.Set(numOfLed_stenkaLed_2-t-1,color_set(r,g,b));
turumputum 0:ea88f8c194d2 268 }
turumputum 0:ea88f8c194d2 269
turumputum 0:ea88f8c194d2 270 for(int t=__sp1; t<(__sp1+__size1); t++) {
turumputum 0:ea88f8c194d2 271 pa_stenkaLed_3.Set(t,color_set(r,g,b));
turumputum 0:ea88f8c194d2 272 }
turumputum 0:ea88f8c194d2 273 //stenkaLed_2.write(pa_stenkaLed_2.getBuf());
turumputum 0:ea88f8c194d2 274 //stenkaLed_3.write(pa_stenkaLed_3.getBuf());
turumputum 0:ea88f8c194d2 275
turumputum 0:ea88f8c194d2 276 } else if(type==1) { //нормальная стенка
turumputum 0:ea88f8c194d2 277
turumputum 1:af17c65e86dc 278 //if(gameState!=bio) {
turumputum 0:ea88f8c194d2 279 for(int t=__sp2; t<(__sp2+__size2); t++) {
turumputum 0:ea88f8c194d2 280 pa_stenkaLed_2.Set(numOfLed_stenkaLed_2-t-1,color_set(r,g,b));
turumputum 0:ea88f8c194d2 281 }
turumputum 0:ea88f8c194d2 282 //stenkaLed_2.write(pa_stenkaLed_2.getBuf());
turumputum 1:af17c65e86dc 283 //}
turumputum 0:ea88f8c194d2 284
turumputum 0:ea88f8c194d2 285 for(int t=__sp1; t<(__sp1+__size1); t++) {
turumputum 0:ea88f8c194d2 286 pa_stenkaLed_1.Set(numOfLed_stenkaLed_1-t-1,color_set(r,g,b));
turumputum 0:ea88f8c194d2 287 }
turumputum 0:ea88f8c194d2 288 //stenkaLed_1.write(pa_stenkaLed_1.getBuf());
turumputum 0:ea88f8c194d2 289
turumputum 0:ea88f8c194d2 290 } else if(type==2) { //нулевой угол мембраны
turumputum 0:ea88f8c194d2 291 for(int t=__sp2; t<(__sp2+__size2); t++) {
turumputum 0:ea88f8c194d2 292 if(t>8) {
turumputum 0:ea88f8c194d2 293 pa_stenkaLed_2.Set(t-9,color_set(r,g,b));
turumputum 0:ea88f8c194d2 294 } else {
turumputum 0:ea88f8c194d2 295 pa_stenkaLed_2.Set(numOfLed_stenkaLed_2-t-1,color_set(r,g,b));
turumputum 0:ea88f8c194d2 296 }
turumputum 0:ea88f8c194d2 297 }
turumputum 0:ea88f8c194d2 298 //stenkaLed_2.write(pa_stenkaLed_2.getBuf());
turumputum 0:ea88f8c194d2 299
turumputum 0:ea88f8c194d2 300 for(int t=__sp1; t<(__sp1+__size1); t++) {
turumputum 0:ea88f8c194d2 301 if(t>8) {
turumputum 0:ea88f8c194d2 302 pa_stenkaLed_3.Set(t-8+124,color_set(r,g,b));
turumputum 0:ea88f8c194d2 303 } else {
turumputum 0:ea88f8c194d2 304 pa_stenkaLed_3.Set(t,color_set(r,g,b));
turumputum 0:ea88f8c194d2 305 }
turumputum 0:ea88f8c194d2 306 }
turumputum 0:ea88f8c194d2 307 //stenkaLed_3.write(pa_stenkaLed_3.getBuf());
turumputum 0:ea88f8c194d2 308
turumputum 0:ea88f8c194d2 309 } else if(type==3) {
turumputum 0:ea88f8c194d2 310 if(gameState!=bio) { //нулевой угол стенки
turumputum 0:ea88f8c194d2 311 for(int t=__sp2; t<(__sp2+__size2); t++) {
turumputum 0:ea88f8c194d2 312 if(t>8) {
turumputum 0:ea88f8c194d2 313 pa_stenkaLed_2.Set(t-9,color_set(r,g,b));
turumputum 0:ea88f8c194d2 314 } else {
turumputum 0:ea88f8c194d2 315 pa_stenkaLed_2.Set(numOfLed_stenkaLed_2-t-1,color_set(r,g,b));
turumputum 0:ea88f8c194d2 316 }
turumputum 0:ea88f8c194d2 317 }
turumputum 0:ea88f8c194d2 318
turumputum 0:ea88f8c194d2 319 //stenkaLed_2.write(pa_stenkaLed_2.getBuf());
turumputum 0:ea88f8c194d2 320 }
turumputum 0:ea88f8c194d2 321 for(int t=__sp1; t<(__sp1+__size1); t++) {
turumputum 0:ea88f8c194d2 322 if(t>8) {
turumputum 0:ea88f8c194d2 323 pa_stenkaLed_1.Set(t-9-1,color_set(r,g,b));
turumputum 0:ea88f8c194d2 324 } else {
turumputum 0:ea88f8c194d2 325 pa_stenkaLed_1.Set(numOfLed_stenkaLed_1-t-1,color_set(r,g,b));
turumputum 0:ea88f8c194d2 326 }
turumputum 0:ea88f8c194d2 327 }
turumputum 0:ea88f8c194d2 328 //stenkaLed_1.write(pa_stenkaLed_1.getBuf());
turumputum 0:ea88f8c194d2 329 }
turumputum 0:ea88f8c194d2 330
turumputum 0:ea88f8c194d2 331 }
turumputum 0:ea88f8c194d2 332
turumputum 0:ea88f8c194d2 333
turumputum 0:ea88f8c194d2 334
turumputum 0:ea88f8c194d2 335
turumputum 0:ea88f8c194d2 336
turumputum 0:ea88f8c194d2 337
turumputum 0:ea88f8c194d2 338
turumputum 0:ea88f8c194d2 339
turumputum 0:ea88f8c194d2 340 //________________________REPORT_______________________
turumputum 0:ea88f8c194d2 341 void stateReport()
turumputum 0:ea88f8c194d2 342 {
turumputum 0:ea88f8c194d2 343 int i;
turumputum 0:ea88f8c194d2 344
turumputum 0:ea88f8c194d2 345 pc.printf("\n");
turumputum 0:ea88f8c194d2 346 pc.printf("tableState: \n");
turumputum 0:ea88f8c194d2 347 pc.printf("Game mode: %d\n", gameState);
turumputum 0:ea88f8c194d2 348 pc.printf("WatchDog ticker: %d\n",gameDog);
turumputum 0:ea88f8c194d2 349 pc.printf("GameCimplete: %d , PlasedSum: %d To complete: %d\n", GameComplete,plasedSum, gameRule[gameState][33]);
turumputum 0:ea88f8c194d2 350
turumputum 0:ea88f8c194d2 351 pc.printf("Time in led light tS: %f tM: %f tI: %f \n", tS,tM,tI);
turumputum 0:ea88f8c194d2 352
turumputum 0:ea88f8c194d2 353 pc.printf(" num of pos:\t");
turumputum 0:ea88f8c194d2 354 i=0;
turumputum 0:ea88f8c194d2 355 for(int b=0; b<30; b++) {
turumputum 0:ea88f8c194d2 356 pc.printf("%d,\t",tableState[i][b]);
turumputum 0:ea88f8c194d2 357 }
turumputum 0:ea88f8c194d2 358 pc.printf("\n");
turumputum 0:ea88f8c194d2 359
turumputum 0:ea88f8c194d2 360 pc.printf(" sensor state:\t");
turumputum 0:ea88f8c194d2 361 i=1;
turumputum 0:ea88f8c194d2 362 for(int b=0; b<30; b++) {
turumputum 0:ea88f8c194d2 363 pc.printf("%d,\t",tableState[i][b]);
turumputum 0:ea88f8c194d2 364 }
turumputum 0:ea88f8c194d2 365 pc.printf("\n");
turumputum 0:ea88f8c194d2 366
turumputum 0:ea88f8c194d2 367 pc.printf(" led effect:\t");
turumputum 0:ea88f8c194d2 368 i=2;
turumputum 0:ea88f8c194d2 369 for(int b=0; b<30; b++) {
turumputum 0:ea88f8c194d2 370 pc.printf("%d,\t",tableState[i][b]);
turumputum 0:ea88f8c194d2 371 }
turumputum 0:ea88f8c194d2 372 pc.printf("\n");
turumputum 0:ea88f8c194d2 373
turumputum 0:ea88f8c194d2 374 pc.printf("effect progress:\t");
turumputum 0:ea88f8c194d2 375 i=3;
turumputum 0:ea88f8c194d2 376 for(int b=0; b<30; b++) {
turumputum 0:ea88f8c194d2 377 pc.printf("%d,\t",tableState[i][b]);
turumputum 0:ea88f8c194d2 378 }
turumputum 0:ea88f8c194d2 379 pc.printf("\n");
turumputum 0:ea88f8c194d2 380
turumputum 0:ea88f8c194d2 381 }
turumputum 0:ea88f8c194d2 382
turumputum 0:ea88f8c194d2 383
turumputum 0:ea88f8c194d2 384
turumputum 0:ea88f8c194d2 385
turumputum 0:ea88f8c194d2 386 //______________________BUTTON_______________________
turumputum 0:ea88f8c194d2 387 void workButton()
turumputum 0:ea88f8c194d2 388 {
turumputum 0:ea88f8c194d2 389 if (gameState==idle) {
turumputum 0:ea88f8c194d2 390 gameDog=0;
turumputum 0:ea88f8c194d2 391 if(Button_4) {
turumputum 0:ea88f8c194d2 392 gameState=rasta;
turumputum 0:ea88f8c194d2 393 if(verbose) {
turumputum 0:ea88f8c194d2 394 pc.printf("Game mode chenged to: rasta\n");
turumputum 0:ea88f8c194d2 395 }
turumputum 0:ea88f8c194d2 396
turumputum 0:ea88f8c194d2 397 setLedRule(gameState);
turumputum 1:af17c65e86dc 398 buttonLight(0,0,1);
turumputum 0:ea88f8c194d2 399 }
turumputum 0:ea88f8c194d2 400 if(Button_2) {
turumputum 0:ea88f8c194d2 401 gameState=bio;
turumputum 0:ea88f8c194d2 402 if(verbose) {
turumputum 0:ea88f8c194d2 403 pc.printf("Game mode chenged to: bio\n");
turumputum 0:ea88f8c194d2 404 }
turumputum 0:ea88f8c194d2 405 setLedRule(gameState);
turumputum 1:af17c65e86dc 406 buttonLight(1,0,0);
turumputum 0:ea88f8c194d2 407 }
turumputum 0:ea88f8c194d2 408 if(Button_3) {
turumputum 0:ea88f8c194d2 409 gameState=bacterium;
turumputum 0:ea88f8c194d2 410 if(verbose) {
turumputum 0:ea88f8c194d2 411 pc.printf("Game mode chenged to: bacterium\n");
turumputum 0:ea88f8c194d2 412 }
turumputum 0:ea88f8c194d2 413 setLedRule(gameState);
turumputum 1:af17c65e86dc 414 buttonLight(0,1,0);
turumputum 0:ea88f8c194d2 415 }
turumputum 0:ea88f8c194d2 416
turumputum 1:af17c65e86dc 417 } else if (((gameState==rasta)||(gameState==bio)||(gameState==bacterium))&&(plasedSum==0)) {
turumputum 1:af17c65e86dc 418 if((Button_1)) {
turumputum 0:ea88f8c194d2 419 gameState=idle;
turumputum 0:ea88f8c194d2 420 if(verbose) {
turumputum 0:ea88f8c194d2 421 pc.printf("Game mode chenged to: idle gameDog: %d \n", gameDog);
turumputum 0:ea88f8c194d2 422 }
turumputum 0:ea88f8c194d2 423 setLedRule(gameState);
turumputum 1:af17c65e86dc 424 buttonLight(1,1,1);
turumputum 0:ea88f8c194d2 425 //stateReport();
turumputum 0:ea88f8c194d2 426 gameDog=0;
turumputum 0:ea88f8c194d2 427 }
turumputum 0:ea88f8c194d2 428 }
turumputum 1:af17c65e86dc 429
turumputum 1:af17c65e86dc 430 if(gameDog>dogIdleCount) {
turumputum 1:af17c65e86dc 431 sleepMode=1;
turumputum 1:af17c65e86dc 432 } else {
turumputum 1:af17c65e86dc 433 if(sleepMode==1) {
turumputum 1:af17c65e86dc 434 sleepMode=0;
turumputum 1:af17c65e86dc 435 setLedRule(gameState);
turumputum 1:af17c65e86dc 436 }
turumputum 1:af17c65e86dc 437 }
turumputum 1:af17c65e86dc 438
turumputum 1:af17c65e86dc 439 if(plasedSum==0) {
turumputum 1:af17c65e86dc 440 int R=(gameRule[idle][30] );
turumputum 1:af17c65e86dc 441 int G=(gameRule[idle][31]);
turumputum 1:af17c65e86dc 442 int B=(gameRule[idle][32]);
turumputum 1:af17c65e86dc 443 pa_ButtonLed_1.SetAll(color_set(R,G,B));
turumputum 1:af17c65e86dc 444 ButtonLed_1.write(pa_ButtonLed_1.getBuf());
turumputum 1:af17c65e86dc 445 } else {
turumputum 1:af17c65e86dc 446 pa_ButtonLed_1.SetAll(color_set(0,0,0));
turumputum 1:af17c65e86dc 447 ButtonLed_1.write(pa_ButtonLed_1.getBuf());
turumputum 1:af17c65e86dc 448 }
turumputum 0:ea88f8c194d2 449 }
turumputum 0:ea88f8c194d2 450
turumputum 1:af17c65e86dc 451 void buttonLight(int b2, int b3, int b4)
turumputum 0:ea88f8c194d2 452 {
turumputum 0:ea88f8c194d2 453
turumputum 1:af17c65e86dc 454 int R=(gameRule[bio][30])*b2;
turumputum 1:af17c65e86dc 455 int G=(gameRule[bio][31])*b2;
turumputum 1:af17c65e86dc 456 int B=(gameRule[bio][32])*b2;
turumputum 0:ea88f8c194d2 457 pa_ButtonLed_2.SetAll(color_set(R,G,B));
turumputum 0:ea88f8c194d2 458 ButtonLed_2.write(pa_ButtonLed_2.getBuf());
turumputum 0:ea88f8c194d2 459
turumputum 0:ea88f8c194d2 460 R=(gameRule[bacterium][30])*b3;
turumputum 0:ea88f8c194d2 461 G=(gameRule[bacterium][31])*b3;
turumputum 0:ea88f8c194d2 462 B=(gameRule[bacterium][32])*b3;
turumputum 0:ea88f8c194d2 463 pa_ButtonLed_3.SetAll(color_set(R,G,B));
turumputum 0:ea88f8c194d2 464 ButtonLed_3.write(pa_ButtonLed_3.getBuf());
turumputum 0:ea88f8c194d2 465
turumputum 0:ea88f8c194d2 466 R=(gameRule[rasta][30])*b4;
turumputum 0:ea88f8c194d2 467 G=(gameRule[rasta][31])*b4;
turumputum 0:ea88f8c194d2 468 B=(gameRule[rasta][32])*b4;
turumputum 0:ea88f8c194d2 469 pa_ButtonLed_4.SetAll(color_set(R,G,B));
turumputum 0:ea88f8c194d2 470 ButtonLed_4.write(pa_ButtonLed_4.getBuf());
turumputum 0:ea88f8c194d2 471 }
turumputum 0:ea88f8c194d2 472
turumputum 0:ea88f8c194d2 473
turumputum 0:ea88f8c194d2 474
turumputum 0:ea88f8c194d2 475 void chekRules()
turumputum 0:ea88f8c194d2 476 {
turumputum 0:ea88f8c194d2 477 plasedSum = 0;
turumputum 0:ea88f8c194d2 478 for(int r=0; r<30; r++) {
turumputum 0:ea88f8c194d2 479 if (tableState[1][r]==1) { //элемент на месте
turumputum 0:ea88f8c194d2 480 if(gameRule[gameState][r]==1) { //проверяем должен ли он там лежать по правилам
turumputum 0:ea88f8c194d2 481 plasedSum++;
turumputum 0:ea88f8c194d2 482 if(GameComplete) { //элемент на месте должен там быть, и конец игры
turumputum 0:ea88f8c194d2 483 if(tableState[2][r]!=LedRun) {
turumputum 0:ea88f8c194d2 484 tableState[2][r]=LedRun;
turumputum 0:ea88f8c194d2 485 tableState[3][r]=0;
turumputum 0:ea88f8c194d2 486 gameDog=0;
turumputum 0:ea88f8c194d2 487
turumputum 0:ea88f8c194d2 488 }
turumputum 0:ea88f8c194d2 489 } else if(tableState[2][r]!=LedOn) { //элемент на месте должен там быть, но еще не все собрали
turumputum 0:ea88f8c194d2 490 tableState[2][r]=LedOn;
turumputum 0:ea88f8c194d2 491 tableState[3][r]=0;
turumputum 0:ea88f8c194d2 492 gameDog=0;
turumputum 0:ea88f8c194d2 493 }
turumputum 0:ea88f8c194d2 494 } else { //элемент на месте но его там не должно быть
turumputum 0:ea88f8c194d2 495 plasedSum--;
turumputum 0:ea88f8c194d2 496
turumputum 0:ea88f8c194d2 497 if((tableState[2][r]!=LedBlink)&&(tableState[2][r]!=LedRun)) {
turumputum 0:ea88f8c194d2 498 tableState[2][r]=LedBlink;
turumputum 0:ea88f8c194d2 499 tableState[3][r]=0;
turumputum 0:ea88f8c194d2 500 gameDog=0;
turumputum 0:ea88f8c194d2 501 }
turumputum 0:ea88f8c194d2 502 }
turumputum 0:ea88f8c194d2 503 } else if((gameRule[gameState][r]==1) && (tableState[1][r]!=1)) { //если элемента нет но должен
turumputum 0:ea88f8c194d2 504 tableState[2][r]=LedWait;
turumputum 0:ea88f8c194d2 505 //plasedSum--;
turumputum 0:ea88f8c194d2 506 } else {
turumputum 1:af17c65e86dc 507 tableState[2][r]=LedWait;
turumputum 0:ea88f8c194d2 508 if(GameComplete) { //элемент нет на месте и не должен там быть, и конец игры
turumputum 0:ea88f8c194d2 509 tableState[2][r]=LedOff; //выкл
turumputum 0:ea88f8c194d2 510 tableState[3][r]=0;
turumputum 1:af17c65e86dc 511 }
turumputum 0:ea88f8c194d2 512 }
turumputum 0:ea88f8c194d2 513 }
turumputum 0:ea88f8c194d2 514
turumputum 0:ea88f8c194d2 515 if(gameState==idle) {
turumputum 0:ea88f8c194d2 516 for(int r=0; r<30; r++) {
turumputum 0:ea88f8c194d2 517 tableState[2][r]=LedOff;
turumputum 0:ea88f8c194d2 518 tableState[3][r]=0;
turumputum 0:ea88f8c194d2 519 }
turumputum 0:ea88f8c194d2 520 }
turumputum 0:ea88f8c194d2 521
turumputum 0:ea88f8c194d2 522
turumputum 0:ea88f8c194d2 523 if(gameRule[gameState][33]==plasedSum) { //проверяем конец игры
turumputum 0:ea88f8c194d2 524 GameComplete=1; // перводим все диоды в бегущий режим
turumputum 0:ea88f8c194d2 525 gameDog+=20;
turumputum 0:ea88f8c194d2 526 } else {
turumputum 0:ea88f8c194d2 527 GameComplete=0;
turumputum 0:ea88f8c194d2 528 }
turumputum 0:ea88f8c194d2 529 }
turumputum 0:ea88f8c194d2 530
turumputum 0:ea88f8c194d2 531
turumputum 0:ea88f8c194d2 532
turumputum 0:ea88f8c194d2 533
turumputum 0:ea88f8c194d2 534 //________________________MAIN__________________________
turumputum 0:ea88f8c194d2 535 int main()
turumputum 0:ea88f8c194d2 536 {
turumputum 0:ea88f8c194d2 537
turumputum 0:ea88f8c194d2 538 pc.baud(115200);
turumputum 0:ea88f8c194d2 539 pc.printf("Hello \n");
turumputum 0:ea88f8c194d2 540 if (verbose) {
turumputum 0:ea88f8c194d2 541 pc.printf("Verbose mode \n");
turumputum 0:ea88f8c194d2 542 } else {
turumputum 0:ea88f8c194d2 543 pc.printf("nonVerbose mode \n");
turumputum 0:ea88f8c194d2 544 }
turumputum 0:ea88f8c194d2 545
turumputum 0:ea88f8c194d2 546 Button_1.mode(PullDown);
turumputum 0:ea88f8c194d2 547 Button_2.mode(PullDown);
turumputum 0:ea88f8c194d2 548 Button_3.mode(PullDown);
turumputum 0:ea88f8c194d2 549 Button_4.mode(PullDown);
turumputum 0:ea88f8c194d2 550
turumputum 0:ea88f8c194d2 551 if (verbose) {
turumputum 0:ea88f8c194d2 552 pc.printf("Button configured \n");
turumputum 0:ea88f8c194d2 553 }
turumputum 0:ea88f8c194d2 554
turumputum 0:ea88f8c194d2 555 //startUp_Led();
turumputum 0:ea88f8c194d2 556
turumputum 0:ea88f8c194d2 557 gameState=idle;
turumputum 1:af17c65e86dc 558 buttonLight(1,1,1);
turumputum 0:ea88f8c194d2 559 setLedRule(gameState);
turumputum 0:ea88f8c194d2 560
turumputum 0:ea88f8c194d2 561
turumputum 0:ea88f8c194d2 562 Ticker t;
turumputum 0:ea88f8c194d2 563 t.attach(&stateReport,1);
turumputum 0:ea88f8c194d2 564 while (true) {
turumputum 0:ea88f8c194d2 565
turumputum 0:ea88f8c194d2 566
turumputum 0:ea88f8c194d2 567 workButton();
turumputum 0:ea88f8c194d2 568 chekRules();
turumputum 0:ea88f8c194d2 569 lightLeds();
turumputum 0:ea88f8c194d2 570 gameDog++;
turumputum 0:ea88f8c194d2 571 //wait(0.1);
turumputum 0:ea88f8c194d2 572
turumputum 0:ea88f8c194d2 573 }
turumputum 0:ea88f8c194d2 574 }
turumputum 0:ea88f8c194d2 575
turumputum 0:ea88f8c194d2 576
turumputum 0:ea88f8c194d2 577
turumputum 0:ea88f8c194d2 578
turumputum 0:ea88f8c194d2 579
turumputum 0:ea88f8c194d2 580
turumputum 0:ea88f8c194d2 581 //_____________________LED___Functions__________________________
turumputum 0:ea88f8c194d2 582
turumputum 0:ea88f8c194d2 583
turumputum 0:ea88f8c194d2 584 void setLedRule(int mode)
turumputum 0:ea88f8c194d2 585 {
turumputum 0:ea88f8c194d2 586 for(int r=0; r<30; r++) { // перводим все диоды в соответвующий режим режим
turumputum 0:ea88f8c194d2 587 //if (gameRule[mode][r]==1) {
turumputum 0:ea88f8c194d2 588 tableState[2][r]=LedWait;
turumputum 0:ea88f8c194d2 589 //tableState[3][r]=0;
turumputum 0:ea88f8c194d2 590 /*} else {
turumputum 0:ea88f8c194d2 591 tableState[2][r]=LedOff;
turumputum 0:ea88f8c194d2 592 tableState[3][r]=0;
turumputum 0:ea88f8c194d2 593 }
turumputum 0:ea88f8c194d2 594 */
turumputum 0:ea88f8c194d2 595 }
turumputum 0:ea88f8c194d2 596 }
turumputum 0:ea88f8c194d2 597
turumputum 0:ea88f8c194d2 598
turumputum 0:ea88f8c194d2 599
turumputum 0:ea88f8c194d2 600 void lightLeds()
turumputum 0:ea88f8c194d2 601 {
turumputum 0:ea88f8c194d2 602
turumputum 0:ea88f8c194d2 603 //Timer t;
turumputum 0:ea88f8c194d2 604 //t.start();
turumputum 0:ea88f8c194d2 605
turumputum 0:ea88f8c194d2 606 stenkaLed_y1.light(tableState[2][0]);
turumputum 0:ea88f8c194d2 607 stenkaLed_s2.light(tableState[2][1]);
turumputum 0:ea88f8c194d2 608 stenkaLed_s3.light(tableState[2][2]);
turumputum 0:ea88f8c194d2 609 stenkaLed_y4.light(tableState[2][3]);
turumputum 0:ea88f8c194d2 610 stenkaLed_s5.light(tableState[2][4]);
turumputum 0:ea88f8c194d2 611 stenkaLed_y6.light(tableState[2][5]);
turumputum 0:ea88f8c194d2 612 stenkaLed_s7.light(tableState[2][6]);
turumputum 0:ea88f8c194d2 613 stenkaLed_s8.light(tableState[2][7]);
turumputum 0:ea88f8c194d2 614 stenkaLed_y9.light(tableState[2][8]);
turumputum 0:ea88f8c194d2 615 stenkaLed_s10.light(tableState[2][9]);
turumputum 0:ea88f8c194d2 616
turumputum 0:ea88f8c194d2 617 membLed_y1.light(tableState[2][10]);
turumputum 0:ea88f8c194d2 618 membLed_s2.light(tableState[2][11]);
turumputum 0:ea88f8c194d2 619 membLed_s3.light(tableState[2][12]);
turumputum 0:ea88f8c194d2 620 membLed_y4.light(tableState[2][13]);
turumputum 0:ea88f8c194d2 621 membLed_s5.light(tableState[2][14]);
turumputum 0:ea88f8c194d2 622 membLed_y6.light(tableState[2][15]);
turumputum 0:ea88f8c194d2 623 membLed_s7.light(tableState[2][16]);
turumputum 0:ea88f8c194d2 624 membLed_s8.light(tableState[2][17]);
turumputum 0:ea88f8c194d2 625 membLed_y9.light(tableState[2][18]);
turumputum 0:ea88f8c194d2 626 membLed_s10.light(tableState[2][19]);
turumputum 0:ea88f8c194d2 627
turumputum 0:ea88f8c194d2 628 //if(gameState!=bio) {
turumputum 0:ea88f8c194d2 629 stenkaLed_1.write(pa_stenkaLed_1.getBuf());
turumputum 0:ea88f8c194d2 630 //}
turumputum 0:ea88f8c194d2 631 stenkaLed_2.write(pa_stenkaLed_2.getBuf());
turumputum 0:ea88f8c194d2 632 stenkaLed_3.write(pa_stenkaLed_3.getBuf());
turumputum 0:ea88f8c194d2 633
turumputum 0:ea88f8c194d2 634 yadroLed.light(tableState[2][20]);
turumputum 0:ea88f8c194d2 635 mitohondriyaLed.light(tableState[2][21]);
turumputum 0:ea88f8c194d2 636 endoplazmaLed.light(tableState[2][22]);
turumputum 0:ea88f8c194d2 637 plastidaLed.light(tableState[2][23]);
turumputum 0:ea88f8c194d2 638 vacuolLed.light(tableState[2][24]);
turumputum 0:ea88f8c194d2 639 lizosomaLed.light(tableState[2][25]);
turumputum 0:ea88f8c194d2 640 goldgiLed.light(tableState[2][26]);
turumputum 0:ea88f8c194d2 641 centorLed.light(tableState[2][27]);
turumputum 0:ea88f8c194d2 642 ribosomaLed.light(tableState[2][28]);
turumputum 0:ea88f8c194d2 643 nucleoidLed.light(tableState[2][29]);
turumputum 0:ea88f8c194d2 644
turumputum 0:ea88f8c194d2 645 //tI=t.read();
turumputum 0:ea88f8c194d2 646 //t.stop();
turumputum 0:ea88f8c194d2 647
turumputum 0:ea88f8c194d2 648
turumputum 0:ea88f8c194d2 649 }
turumputum 0:ea88f8c194d2 650
turumputum 0:ea88f8c194d2 651
turumputum 0:ea88f8c194d2 652
turumputum 0:ea88f8c194d2 653 void fadeEffect()
turumputum 0:ea88f8c194d2 654 {
turumputum 0:ea88f8c194d2 655 for(int t=0; t<100; t++) {
turumputum 0:ea88f8c194d2 656 yadroLed.light(LedOff);
turumputum 0:ea88f8c194d2 657 mitohondriyaLed.light(LedOff);
turumputum 0:ea88f8c194d2 658 endoplazmaLed.light(LedOff);
turumputum 0:ea88f8c194d2 659 plastidaLed.light(LedOff);
turumputum 0:ea88f8c194d2 660 vacuolLed.light(LedOff);
turumputum 0:ea88f8c194d2 661 lizosomaLed.light(LedOff);
turumputum 0:ea88f8c194d2 662 goldgiLed.light(LedOff);
turumputum 0:ea88f8c194d2 663 centorLed.light(LedOff);
turumputum 0:ea88f8c194d2 664 ribosomaLed.light(LedOff);
turumputum 0:ea88f8c194d2 665 nucleoidLed.light(LedOff);
turumputum 0:ea88f8c194d2 666 }
turumputum 0:ea88f8c194d2 667 }
turumputum 0:ea88f8c194d2 668 void writeStenksLeds()
turumputum 0:ea88f8c194d2 669 {
turumputum 0:ea88f8c194d2 670 stenkaLed_1.write(pa_stenkaLed_1.getBuf());
turumputum 0:ea88f8c194d2 671 stenkaLed_2.write(pa_stenkaLed_2.getBuf());
turumputum 0:ea88f8c194d2 672 stenkaLed_3.write(pa_stenkaLed_3.getBuf());
turumputum 0:ea88f8c194d2 673 }
turumputum 0:ea88f8c194d2 674
turumputum 0:ea88f8c194d2 675
turumputum 0:ea88f8c194d2 676 void startUp_Led()
turumputum 0:ea88f8c194d2 677 {
turumputum 0:ea88f8c194d2 678 int tt=50;
turumputum 0:ea88f8c194d2 679 gameState=bio;
turumputum 0:ea88f8c194d2 680
turumputum 0:ea88f8c194d2 681
turumputum 0:ea88f8c194d2 682 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 683 stenkaLed_y1.light(LedBlink);
turumputum 0:ea88f8c194d2 684 writeStenksLeds();
turumputum 0:ea88f8c194d2 685 }
turumputum 0:ea88f8c194d2 686 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 687 membLed_y1.light(LedBlink);
turumputum 0:ea88f8c194d2 688 writeStenksLeds();
turumputum 0:ea88f8c194d2 689 }
turumputum 0:ea88f8c194d2 690 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 691 stenkaLed_s2.light(LedBlink);
turumputum 0:ea88f8c194d2 692 writeStenksLeds();
turumputum 0:ea88f8c194d2 693 }
turumputum 0:ea88f8c194d2 694 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 695 membLed_s2.light(LedBlink);
turumputum 0:ea88f8c194d2 696 writeStenksLeds();
turumputum 0:ea88f8c194d2 697 }
turumputum 0:ea88f8c194d2 698 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 699 stenkaLed_s3.light(LedBlink);
turumputum 0:ea88f8c194d2 700 writeStenksLeds();
turumputum 0:ea88f8c194d2 701 }
turumputum 0:ea88f8c194d2 702 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 703 membLed_s3.light(LedBlink);
turumputum 0:ea88f8c194d2 704 writeStenksLeds();
turumputum 0:ea88f8c194d2 705 }
turumputum 0:ea88f8c194d2 706 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 707 stenkaLed_y4.light(LedBlink);
turumputum 0:ea88f8c194d2 708 writeStenksLeds();
turumputum 0:ea88f8c194d2 709 }
turumputum 0:ea88f8c194d2 710 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 711 membLed_y4.light(LedBlink);
turumputum 0:ea88f8c194d2 712 writeStenksLeds();
turumputum 0:ea88f8c194d2 713 }
turumputum 0:ea88f8c194d2 714 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 715 stenkaLed_s5.light(LedBlink);
turumputum 0:ea88f8c194d2 716 writeStenksLeds();
turumputum 0:ea88f8c194d2 717 }
turumputum 0:ea88f8c194d2 718 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 719 membLed_s5.light(LedBlink);
turumputum 0:ea88f8c194d2 720 writeStenksLeds();
turumputum 0:ea88f8c194d2 721 }
turumputum 0:ea88f8c194d2 722 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 723 stenkaLed_y6.light(LedBlink);
turumputum 0:ea88f8c194d2 724 writeStenksLeds();
turumputum 0:ea88f8c194d2 725 }
turumputum 0:ea88f8c194d2 726 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 727 membLed_y6.light(LedBlink);
turumputum 0:ea88f8c194d2 728 writeStenksLeds();
turumputum 0:ea88f8c194d2 729 }
turumputum 0:ea88f8c194d2 730 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 731 stenkaLed_s7.light(LedBlink);
turumputum 0:ea88f8c194d2 732 writeStenksLeds();
turumputum 0:ea88f8c194d2 733 }
turumputum 0:ea88f8c194d2 734 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 735 membLed_s7.light(LedBlink);
turumputum 0:ea88f8c194d2 736 writeStenksLeds();
turumputum 0:ea88f8c194d2 737 }
turumputum 0:ea88f8c194d2 738 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 739 stenkaLed_s8.light(LedBlink);
turumputum 0:ea88f8c194d2 740 writeStenksLeds();
turumputum 0:ea88f8c194d2 741 }
turumputum 0:ea88f8c194d2 742 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 743 membLed_s8.light(LedBlink);
turumputum 0:ea88f8c194d2 744 writeStenksLeds();
turumputum 0:ea88f8c194d2 745 }
turumputum 0:ea88f8c194d2 746 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 747 stenkaLed_y9.light(LedBlink);
turumputum 0:ea88f8c194d2 748 writeStenksLeds();
turumputum 0:ea88f8c194d2 749 }
turumputum 0:ea88f8c194d2 750 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 751 membLed_y9.light(LedBlink);
turumputum 0:ea88f8c194d2 752 writeStenksLeds();
turumputum 0:ea88f8c194d2 753 }
turumputum 0:ea88f8c194d2 754 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 755 stenkaLed_s10.light(LedBlink);
turumputum 0:ea88f8c194d2 756 writeStenksLeds();
turumputum 0:ea88f8c194d2 757
turumputum 0:ea88f8c194d2 758 }
turumputum 0:ea88f8c194d2 759 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 760 membLed_s10.light(LedBlink);
turumputum 0:ea88f8c194d2 761 writeStenksLeds();
turumputum 0:ea88f8c194d2 762 }
turumputum 0:ea88f8c194d2 763
turumputum 0:ea88f8c194d2 764 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 765 yadroLed.light(LedBlink);
turumputum 0:ea88f8c194d2 766 }
turumputum 0:ea88f8c194d2 767 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 768 mitohondriyaLed.light(LedBlink);
turumputum 0:ea88f8c194d2 769 }
turumputum 0:ea88f8c194d2 770 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 771 endoplazmaLed.light(LedBlink);
turumputum 0:ea88f8c194d2 772 }
turumputum 0:ea88f8c194d2 773 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 774 plastidaLed.light(LedBlink);
turumputum 0:ea88f8c194d2 775 }
turumputum 0:ea88f8c194d2 776 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 777 vacuolLed.light(LedBlink);
turumputum 0:ea88f8c194d2 778 }
turumputum 0:ea88f8c194d2 779 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 780 lizosomaLed.light(LedBlink);
turumputum 0:ea88f8c194d2 781 }
turumputum 0:ea88f8c194d2 782 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 783 goldgiLed.light(LedBlink);
turumputum 0:ea88f8c194d2 784 }
turumputum 0:ea88f8c194d2 785 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 786 centorLed.light(LedBlink);
turumputum 0:ea88f8c194d2 787 }
turumputum 0:ea88f8c194d2 788 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 789 ribosomaLed.light(LedBlink);
turumputum 0:ea88f8c194d2 790 }
turumputum 0:ea88f8c194d2 791 for(int q=0; q<tt; q++) {
turumputum 0:ea88f8c194d2 792 nucleoidLed.light(LedBlink);
turumputum 0:ea88f8c194d2 793 }
turumputum 0:ea88f8c194d2 794
turumputum 0:ea88f8c194d2 795
turumputum 0:ea88f8c194d2 796 }
turumputum 0:ea88f8c194d2 797
turumputum 0:ea88f8c194d2 798