123

Dependencies:   WS2812 PixelArray DebounceIn

Committer:
turumputum
Date:
Wed Jun 24 12:41:45 2020 +0000
Revision:
0:ea88f8c194d2
Child:
1:af17c65e86dc
good for me

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