a

Dependencies:   Locate Move Servo button mbed

Fork of 4thcomp by 涼太郎 中村

Committer:
choutin
Date:
Sat Sep 17 23:23:08 2016 +0000
Revision:
21:7df0f8cd2737
Parent:
20:4b8ce61a00b2
?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sakanakuuun 0:f12d257b587e 1 #include "mbed.h"
choutin 3:56b034c41dc5 2 #include "math.h"
sakanakuuun 4:1604d599d40f 3 #include "locate.h"
sakanakuuun 4:1604d599d40f 4 #include "move.h"
choutin 12:456d651ef4f0 5 #include "servo.h"
choutin 12:456d651ef4f0 6 #include "button.h"
choutin 3:56b034c41dc5 7
choutin 16:a9885a66048f 8 DigitalOut ledg(PC_2); //green
choutin 16:a9885a66048f 9 DigitalOut ledy(PC_3); //yellow
choutin 16:a9885a66048f 10 DigitalOut ledr(PC_0); //red
choutin 16:a9885a66048f 11
choutin 16:a9885a66048f 12
choutin 17:5b9fbb6133ad 13 const int dist=150;//タイヤ、アーム間の距離
choutin 20:4b8ce61a00b2 14 const int slidedist=0; //102-20;
choutin 18:aa8c08f6f474 15 const int space=50;//壁やばそうなときのよゆう
choutin 20:4b8ce61a00b2 16 //btimeはservoに移動
choutin 17:5b9fbb6133ad 17 const float allowdegree=0.2;
choutin 17:5b9fbb6133ad 18 const float allowlength=0.2;
choutin 17:5b9fbb6133ad 19
choutin 20:4b8ce61a00b2 20 const int unit=583;
choutin 20:4b8ce61a00b2 21
choutin 17:5b9fbb6133ad 22
sakanakuuun 4:1604d599d40f 23 int main()
choutin 21:7df0f8cd2737 24 {
choutin 21:7df0f8cd2737 25 Serial pc(SERIAL_TX, SERIAL_RX); //pcと通信
choutin 18:aa8c08f6f474 26 int teams=1,phase=0;
choutin 18:aa8c08f6f474 27 teams=teamLED();
choutin 18:aa8c08f6f474 28 int team = 1;
choutin 18:aa8c08f6f474 29 setup(teams);
choutin 18:aa8c08f6f474 30 initmotor(teams);
choutin 21:7df0f8cd2737 31
choutin 18:aa8c08f6f474 32 open_arm();
choutin 18:aa8c08f6f474 33 wait(2);
choutin 17:5b9fbb6133ad 34 close_arm();
choutin 20:4b8ce61a00b2 35 buzzer(1);
choutin 20:4b8ce61a00b2 36 wait(1);
choutin 20:4b8ce61a00b2 37 buzzer(0);
choutin 21:7df0f8cd2737 38
choutin 21:7df0f8cd2737 39 int targetx[9] = { 600,600,600,1200,900,1200,900,1200,900 };
choutin 21:7df0f8cd2737 40 int targety[9] = { team*(300+slidedist),team*(600+slidedist),team*(900+slidedist),team*(1200+slidedist),team*(900+slidedist),team*(600+slidedist),team*(600+slidedist),team*(0+slidedist),team*(300+slidedist) };
choutin 21:7df0f8cd2737 41 int goalx=220,goaly=1200-30+(slidedist)*0;//yへのslidediatを無視
choutin 21:7df0f8cd2737 42
choutin 17:5b9fbb6133ad 43 phase=phaseSW();
choutin 21:7df0f8cd2737 44
choutin 21:7df0f8cd2737 45 if(phase==0) {
choutin 21:7df0f8cd2737 46 buzzer(1);
choutin 21:7df0f8cd2737 47 wait(0.4);
choutin 21:7df0f8cd2737 48 buzzer(0);
choutin 21:7df0f8cd2737 49 wait(0.2);
choutin 21:7df0f8cd2737 50 buzzer(1);
choutin 21:7df0f8cd2737 51 wait(0.4);
choutin 21:7df0f8cd2737 52 buzzer(0);
choutin 21:7df0f8cd2737 53 wait(0.2);
choutin 21:7df0f8cd2737 54 buzzer(1);
choutin 21:7df0f8cd2737 55 wait(0.4);
choutin 21:7df0f8cd2737 56 buzzer(0);
choutin 21:7df0f8cd2737 57 }
choutin 21:7df0f8cd2737 58
choutin 21:7df0f8cd2737 59 while(start()) {}
choutin 21:7df0f8cd2737 60 if(phase==15) {
choutin 20:4b8ce61a00b2 61 movelength(900);
choutin 21:7df0f8cd2737 62 buzzer(1);
choutin 21:7df0f8cd2737 63
choutin 21:7df0f8cd2737 64 while(1) {
choutin 21:7df0f8cd2737 65 update();
choutin 21:7df0f8cd2737 66 }
choutin 21:7df0f8cd2737 67 }
choutin 21:7df0f8cd2737 68
choutin 21:7df0f8cd2737 69 if(phase==14) {
choutin 21:7df0f8cd2737 70 int i = 1;
choutin 21:7df0f8cd2737 71 while(1)
choutin 21:7df0f8cd2737 72 {
choutin 21:7df0f8cd2737 73
choutin 21:7df0f8cd2737 74 turnrad(-2*PI*3*(i++));
choutin 21:7df0f8cd2737 75 wait(5);
choutin 20:4b8ce61a00b2 76 }
choutin 20:4b8ce61a00b2 77
choutin 21:7df0f8cd2737 78 while(1) {
choutin 21:7df0f8cd2737 79 update();
choutin 20:4b8ce61a00b2 80 }
choutin 21:7df0f8cd2737 81 }
choutin 21:7df0f8cd2737 82 if(phase==13) {
choutin 21:7df0f8cd2737 83 move(-70, -70);
choutin 21:7df0f8cd2737 84 }
choutin 21:7df0f8cd2737 85
choutin 21:7df0f8cd2737 86 if(phase==12) {
choutin 21:7df0f8cd2737 87 while(1) {
choutin 20:4b8ce61a00b2 88 open_arm();
choutin 20:4b8ce61a00b2 89 wait(3);
choutin 20:4b8ce61a00b2 90 close_arm();
choutin 20:4b8ce61a00b2 91 wait(3);
choutin 20:4b8ce61a00b2 92 }
choutin 20:4b8ce61a00b2 93 }
choutin 21:7df0f8cd2737 94
choutin 21:7df0f8cd2737 95 if(phase==11) {
choutin 21:7df0f8cd2737 96 while(1) {
choutin 20:4b8ce61a00b2 97 close_hand();
choutin 20:4b8ce61a00b2 98 wait(0.3);
choutin 20:4b8ce61a00b2 99 lift();
choutin 20:4b8ce61a00b2 100 wait(0.2);
choutin 20:4b8ce61a00b2 101 open_hand();
choutin 20:4b8ce61a00b2 102 wait(2);
choutin 20:4b8ce61a00b2 103 }
choutin 20:4b8ce61a00b2 104 }
choutin 21:7df0f8cd2737 105
choutin 21:7df0f8cd2737 106 if(phase==10) {
choutin 21:7df0f8cd2737 107 while(1) {
choutin 21:7df0f8cd2737 108 move(70,70);
choutin 21:7df0f8cd2737 109 update();
choutin 21:7df0f8cd2737 110 }
choutin 21:7df0f8cd2737 111 }
choutin 21:7df0f8cd2737 112 if(phase==9) {
choutin 21:7df0f8cd2737 113 while(1) {
choutin 21:7df0f8cd2737 114 move(32,30);
choutin 21:7df0f8cd2737 115 while(1) {
choutin 21:7df0f8cd2737 116 update_np();
choutin 21:7df0f8cd2737 117 if(coordinateX()>900) {
choutin 21:7df0f8cd2737 118 break;
choutin 21:7df0f8cd2737 119 }
choutin 21:7df0f8cd2737 120 }
choutin 21:7df0f8cd2737 121 pc.printf("start");
choutin 21:7df0f8cd2737 122 update();
choutin 21:7df0f8cd2737 123 }
choutin 21:7df0f8cd2737 124 }
choutin 21:7df0f8cd2737 125
choutin 14:0629ab54765c 126 //オブジェクト0,1,2回収
choutin 21:7df0f8cd2737 127 if(phase==0) {
choutin 21:7df0f8cd2737 128
choutin 21:7df0f8cd2737 129 pmove2(targetx[0],-60);
choutin 21:7df0f8cd2737 130 open_hand();
choutin 21:7df0f8cd2737 131 pmove2(targetx[0],targety[0]);
choutin 21:7df0f8cd2737 132 close_hand();
choutin 21:7df0f8cd2737 133 wait(0.3);
choutin 20:4b8ce61a00b2 134 lift();
choutin 21:7df0f8cd2737 135 open_hand();
choutin 21:7df0f8cd2737 136 //回収
choutin 21:7df0f8cd2737 137 pmove2(targetx[1],targety[1]);
choutin 21:7df0f8cd2737 138 close_hand();
choutin 21:7df0f8cd2737 139 wait(0.3);
choutin 20:4b8ce61a00b2 140 lift();
choutin 21:7df0f8cd2737 141 open_hand();
choutin 21:7df0f8cd2737 142 //回収
choutin 21:7df0f8cd2737 143 pmove2(targetx[2],targety[2]);
choutin 21:7df0f8cd2737 144 //回収
choutin 21:7df0f8cd2737 145 close_hand();
choutin 21:7df0f8cd2737 146 pmove2(goalx,goaly-40);
choutin 21:7df0f8cd2737 147 //リリース
choutin 21:7df0f8cd2737 148 turnrad_ccw(PI,team);
choutin 21:7df0f8cd2737 149 open_arm();
choutin 21:7df0f8cd2737 150 open_hand();
choutin 21:7df0f8cd2737 151 wait(0.5);
choutin 21:7df0f8cd2737 152
choutin 21:7df0f8cd2737 153 back300();//(300,1200)なう
choutin 18:aa8c08f6f474 154 turnrad_ccw(2*PI,team);
choutin 18:aa8c08f6f474 155 //--------------------------------------------------------------------
choutin 21:7df0f8cd2737 156 open_hand();
choutin 21:7df0f8cd2737 157 \
choutin 21:7df0f8cd2737 158 pmove2(targetx[3]-50,targety[3]);
choutin 20:4b8ce61a00b2 159
choutin 21:7df0f8cd2737 160 close_arm();
choutin 21:7df0f8cd2737 161 close_hand();
choutin 21:7df0f8cd2737 162 turnrad_cw(PI,team);
choutin 21:7df0f8cd2737 163
choutin 21:7df0f8cd2737 164 pmove2(300,team*(goaly));//ゴール
choutin 18:aa8c08f6f474 165
choutin 18:aa8c08f6f474 166 open_arm();
choutin 18:aa8c08f6f474 167 open_hand();
choutin 18:aa8c08f6f474 168 wait(0.3);
choutin 18:aa8c08f6f474 169
choutin 21:7df0f8cd2737 170
choutin 18:aa8c08f6f474 171 back300();
choutin 18:aa8c08f6f474 172 turnrad_ccw(2*PI,team);
choutin 18:aa8c08f6f474 173 phase=2;
choutin 21:7df0f8cd2737 174
choutin 21:7df0f8cd2737 175 //また縦に回収
choutin 21:7df0f8cd2737 176 close_arm();
choutin 21:7df0f8cd2737 177 pmove2(900,team*(1200+30));
choutin 18:aa8c08f6f474 178
choutin 21:7df0f8cd2737 179 open_hand();
choutin 21:7df0f8cd2737 180 pmove2(targetx[4],targety[4]);
choutin 21:7df0f8cd2737 181 close_hand();
choutin 21:7df0f8cd2737 182 wait(0.3);
choutin 20:4b8ce61a00b2 183 lift();
choutin 21:7df0f8cd2737 184 open_hand();
choutin 21:7df0f8cd2737 185 //回収
choutin 21:7df0f8cd2737 186 pmove2(targetx[6],targety[6]);
choutin 21:7df0f8cd2737 187 close_hand();
choutin 21:7df0f8cd2737 188 wait(0.3);
choutin 20:4b8ce61a00b2 189 lift();
choutin 21:7df0f8cd2737 190 open_hand();
choutin 21:7df0f8cd2737 191 //回収
choutin 21:7df0f8cd2737 192 pmove2(targetx[8],targety[8]);
choutin 21:7df0f8cd2737 193 //回収
choutin 21:7df0f8cd2737 194 close_hand();
choutin 21:7df0f8cd2737 195 pmove2(150,team*(600+slidedist));//斜め移動
choutin 21:7df0f8cd2737 196
choutin 21:7df0f8cd2737 197 turnrad_ccw(PI,team);
choutin 21:7df0f8cd2737 198 open_arm();
choutin 21:7df0f8cd2737 199 open_hand();
choutin 21:7df0f8cd2737 200 back300();
choutin 21:7df0f8cd2737 201
choutin 21:7df0f8cd2737 202
choutin 21:7df0f8cd2737 203 pmove2(600,600);
choutin 21:7df0f8cd2737 204 pmove2(targetx[5]-50,targety[5]);
choutin 21:7df0f8cd2737 205 close_arm();
choutin 21:7df0f8cd2737 206 close_hand();
choutin 21:7df0f8cd2737 207 nxback300();
choutin 21:7df0f8cd2737 208 pmove2(150,600+slidedist);
choutin 21:7df0f8cd2737 209 open_arm();
choutin 21:7df0f8cd2737 210 open_hand();
choutin 21:7df0f8cd2737 211 back300();
choutin 21:7df0f8cd2737 212 pmove2(900-50,50);
choutin 21:7df0f8cd2737 213 pmove2(1200-90,0);
choutin 21:7df0f8cd2737 214 close_arm();
choutin 21:7df0f8cd2737 215 close_hand();
choutin 21:7df0f8cd2737 216 nxback300();
choutin 21:7df0f8cd2737 217 pmove2(150,900+slidedist);
choutin 21:7df0f8cd2737 218 turnrad_ccw(PI,team);
choutin 21:7df0f8cd2737 219 open_arm();
choutin 21:7df0f8cd2737 220 open_hand();
choutin 21:7df0f8cd2737 221 back300();
choutin 21:7df0f8cd2737 222
choutin 21:7df0f8cd2737 223 while(1) {
choutin 18:aa8c08f6f474 224 buzzer(1);
choutin 18:aa8c08f6f474 225 wait(0.5);
choutin 18:aa8c08f6f474 226 buzzer(0);
choutin 21:7df0f8cd2737 227 wait(1);
choutin 18:aa8c08f6f474 228 }
choutin 17:5b9fbb6133ad 229 }
choutin 21:7df0f8cd2737 230
choutin 21:7df0f8cd2737 231
choutin 21:7df0f8cd2737 232 if(phase==2) {
choutin 19:e3383efa483b 233 open_arm();
choutin 21:7df0f8cd2737 234
choutin 19:e3383efa483b 235 open_hand();
choutin 21:7df0f8cd2737 236 pmove2(900,0);
choutin 21:7df0f8cd2737 237 pmove2(1200-80,0);//オブジェクト
choutin 21:7df0f8cd2737 238 close_arm();
choutin 21:7df0f8cd2737 239 close_hand();
choutin 21:7df0f8cd2737 240 nxback300();
choutin 21:7df0f8cd2737 241 pmove2(150,900+slidedist);
choutin 21:7df0f8cd2737 242 turnrad_ccw(PI,team);
choutin 21:7df0f8cd2737 243 open_arm();
choutin 21:7df0f8cd2737 244 open_hand();
choutin 21:7df0f8cd2737 245 back300();
choutin 21:7df0f8cd2737 246
choutin 21:7df0f8cd2737 247 pmove2(600,600);
choutin 21:7df0f8cd2737 248 pmove2(targetx[5]-80,targety[5]);
choutin 21:7df0f8cd2737 249 close_arm();
choutin 21:7df0f8cd2737 250 close_hand();
choutin 21:7df0f8cd2737 251 nxback300();
choutin 21:7df0f8cd2737 252 pmove2(150,600+slidedist);
choutin 21:7df0f8cd2737 253 back300();
choutin 21:7df0f8cd2737 254
choutin 20:4b8ce61a00b2 255 }
choutin 21:7df0f8cd2737 256
choutin 21:7df0f8cd2737 257 if(phase==1) {
choutin 20:4b8ce61a00b2 258
choutin 21:7df0f8cd2737 259 pmove(900,0);
choutin 21:7df0f8cd2737 260 open_hand();
choutin 21:7df0f8cd2737 261 pmove2(targetx[8],targety[8]);
choutin 21:7df0f8cd2737 262 close_hand();
choutin 21:7df0f8cd2737 263 wait(0.3);
choutin 20:4b8ce61a00b2 264 lift();
choutin 21:7df0f8cd2737 265 open_hand();
choutin 21:7df0f8cd2737 266 //回収
choutin 21:7df0f8cd2737 267 pmove2(targetx[6],targety[6]);
choutin 21:7df0f8cd2737 268 close_hand();
choutin 21:7df0f8cd2737 269 wait(0.3);
choutin 20:4b8ce61a00b2 270 lift();
choutin 21:7df0f8cd2737 271 open_hand();
choutin 21:7df0f8cd2737 272 //回収
choutin 21:7df0f8cd2737 273 pmove(targetx[4],targety[4]);
choutin 21:7df0f8cd2737 274 //回収
choutin 21:7df0f8cd2737 275 close_hand();
choutin 21:7df0f8cd2737 276 pmove2(goalx,goaly-40);
choutin 21:7df0f8cd2737 277 //リリース
choutin 21:7df0f8cd2737 278 turnrad_ccw(PI,team);
choutin 21:7df0f8cd2737 279 open_arm();
choutin 21:7df0f8cd2737 280 open_hand();
choutin 21:7df0f8cd2737 281 wait(0.5);
choutin 21:7df0f8cd2737 282 back300();//(300,1200)なう
choutin 21:7df0f8cd2737 283
choutin 17:5b9fbb6133ad 284 }
choutin 21:7df0f8cd2737 285
choutin 21:7df0f8cd2737 286
choutin 21:7df0f8cd2737 287 if(phase==3) {
choutin 21:7df0f8cd2737 288
choutin 20:4b8ce61a00b2 289
choutin 21:7df0f8cd2737 290 pmove2(targetx[0],-60);
choutin 21:7df0f8cd2737 291 open_hand();
choutin 21:7df0f8cd2737 292 pmove2(targetx[0],targety[0]);
choutin 21:7df0f8cd2737 293 close_hand();
choutin 21:7df0f8cd2737 294 wait(0.3);
choutin 20:4b8ce61a00b2 295 lift();
choutin 21:7df0f8cd2737 296 open_hand();
choutin 21:7df0f8cd2737 297 //回収
choutin 21:7df0f8cd2737 298 pmove2(targetx[1],targety[1]);
choutin 21:7df0f8cd2737 299 close_hand();
choutin 21:7df0f8cd2737 300 wait(0.3);
choutin 20:4b8ce61a00b2 301 lift();
choutin 21:7df0f8cd2737 302 open_hand();
choutin 21:7df0f8cd2737 303 //回収
choutin 21:7df0f8cd2737 304 pmove2(targetx[2],targety[2]);
choutin 21:7df0f8cd2737 305 //回収
choutin 21:7df0f8cd2737 306 close_hand();
choutin 21:7df0f8cd2737 307 pmove2(goalx,goaly-40);
choutin 21:7df0f8cd2737 308 //リリース
choutin 21:7df0f8cd2737 309 turnrad_ccw(PI,team);
choutin 21:7df0f8cd2737 310 open_arm();
choutin 21:7df0f8cd2737 311 open_hand();
choutin 21:7df0f8cd2737 312 wait(0.5);
choutin 21:7df0f8cd2737 313 back300();//(300,1200)なう
choutin 20:4b8ce61a00b2 314 turnrad_ccw(2*PI,team);
choutin 21:7df0f8cd2737 315
choutin 21:7df0f8cd2737 316
choutin 20:4b8ce61a00b2 317 close_arm();
choutin 21:7df0f8cd2737 318 pmove2(900,team*(1200+30));
choutin 20:4b8ce61a00b2 319
choutin 21:7df0f8cd2737 320 open_hand();
choutin 21:7df0f8cd2737 321 pmove2(targetx[4],targety[4]);
choutin 21:7df0f8cd2737 322 close_hand();
choutin 21:7df0f8cd2737 323 wait(0.3);
choutin 20:4b8ce61a00b2 324 lift();
choutin 21:7df0f8cd2737 325 open_hand();
choutin 21:7df0f8cd2737 326 //回収
choutin 21:7df0f8cd2737 327 pmove2(targetx[6],targety[6]);
choutin 21:7df0f8cd2737 328 close_hand();
choutin 21:7df0f8cd2737 329 wait(0.3);
choutin 20:4b8ce61a00b2 330 lift();
choutin 21:7df0f8cd2737 331 open_hand();
choutin 21:7df0f8cd2737 332 //回収
choutin 21:7df0f8cd2737 333 pmove2(targetx[8],targety[8]);
choutin 21:7df0f8cd2737 334 //回収
choutin 21:7df0f8cd2737 335 close_hand();
choutin 21:7df0f8cd2737 336 pmove2(150,team*(600+slidedist));//斜め移動
choutin 21:7df0f8cd2737 337
choutin 21:7df0f8cd2737 338 turnrad_ccw((-1)*PI,team);
choutin 21:7df0f8cd2737 339 open_arm();
choutin 21:7df0f8cd2737 340 open_hand();
choutin 21:7df0f8cd2737 341 back300();
choutin 20:4b8ce61a00b2 342 }
choutin 21:7df0f8cd2737 343
choutin 21:7df0f8cd2737 344 if(phase == 10) {
choutin 21:7df0f8cd2737 345 buzzer(1);
choutin 20:4b8ce61a00b2 346 turnrad(6*PI);
choutin 20:4b8ce61a00b2 347 while(1) update();
choutin 20:4b8ce61a00b2 348 }
choutin 21:7df0f8cd2737 349
choutin 21:7df0f8cd2737 350
choutin 21:7df0f8cd2737 351
choutin 21:7df0f8cd2737 352 if(phase == 8) {
choutin 21:7df0f8cd2737 353 open_arm();
choutin 20:4b8ce61a00b2 354 open_hand();
choutin 21:7df0f8cd2737 355
choutin 20:4b8ce61a00b2 356 pmove2(0,1000);
choutin 20:4b8ce61a00b2 357 pmove2(600,1200);
choutin 20:4b8ce61a00b2 358 pmove2(1200-50,1200);
choutin 20:4b8ce61a00b2 359 close_hand();
choutin 20:4b8ce61a00b2 360 close_arm();
choutin 20:4b8ce61a00b2 361 turnrad_cw((-1)*PI,1);
choutin 20:4b8ce61a00b2 362 pmove2(150,1200);
choutin 20:4b8ce61a00b2 363 open_hand();
choutin 20:4b8ce61a00b2 364 open_arm();
choutin 20:4b8ce61a00b2 365 back300();
choutin 21:7df0f8cd2737 366
choutin 20:4b8ce61a00b2 367 turnrad_ccw(0,1);
choutin 20:4b8ce61a00b2 368 pmove2(1800,1200);
choutin 20:4b8ce61a00b2 369 close_hand();
choutin 20:4b8ce61a00b2 370 close_arm();
choutin 20:4b8ce61a00b2 371 turnrad_cw((-1)*PI,1);
choutin 20:4b8ce61a00b2 372 pmove2(150,1200);
choutin 20:4b8ce61a00b2 373 open_hand();
choutin 20:4b8ce61a00b2 374 open_arm();
choutin 20:4b8ce61a00b2 375 back300();
choutin 20:4b8ce61a00b2 376 }
choutin 21:7df0f8cd2737 377
choutin 21:7df0f8cd2737 378 if(phase == 7) {
choutin 21:7df0f8cd2737 379 open_arm();
choutin 20:4b8ce61a00b2 380 open_hand();
choutin 21:7df0f8cd2737 381
choutin 20:4b8ce61a00b2 382 pmove2(0,1000);
choutin 20:4b8ce61a00b2 383 pmove2(600,1200);
choutin 20:4b8ce61a00b2 384 pmove2(1800,1200);
choutin 20:4b8ce61a00b2 385 close_hand();
choutin 20:4b8ce61a00b2 386 close_arm();
choutin 20:4b8ce61a00b2 387 turnrad_cw((-1)*PI,1);
choutin 20:4b8ce61a00b2 388 pmove2(150,1200);
choutin 20:4b8ce61a00b2 389 open_hand();
choutin 20:4b8ce61a00b2 390 open_arm();
choutin 20:4b8ce61a00b2 391 back300();
choutin 21:7df0f8cd2737 392
choutin 21:7df0f8cd2737 393
choutin 20:4b8ce61a00b2 394 }
choutin 21:7df0f8cd2737 395
choutin 21:7df0f8cd2737 396 if(phase == 6) {
choutin 21:7df0f8cd2737 397 buzzer(1);
choutin 20:4b8ce61a00b2 398 initbutton();
choutin 20:4b8ce61a00b2 399 int command[3];
choutin 20:4b8ce61a00b2 400 commandIn(command);
choutin 21:7df0f8cd2737 401
choutin 20:4b8ce61a00b2 402 commandMove(command[0], command[1], command[2]);
choutin 20:4b8ce61a00b2 403 }
choutin 21:7df0f8cd2737 404
choutin 21:7df0f8cd2737 405 if(phase == 5) {
choutin 21:7df0f8cd2737 406 buzzer(1);
choutin 20:4b8ce61a00b2 407 initbutton();
choutin 20:4b8ce61a00b2 408 int command[3];
choutin 20:4b8ce61a00b2 409 commandIn(command);
choutin 21:7df0f8cd2737 410
choutin 20:4b8ce61a00b2 411 commandMoveEnemy(command[0], command[1], command[2]);
choutin 20:4b8ce61a00b2 412 }
choutin 21:7df0f8cd2737 413
choutin 18:aa8c08f6f474 414 }