Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed TrapezoidControl QEI
Process.cpp
00001 00002 #include "mbed.h" 00003 #include "Process.h" 00004 #include "QEI.h" 00005 00006 #include "../../CommonLibraries/PID/PID.h" 00007 #include "../../Communication/RS485/ActuatorHub/ActuatorHub.h" 00008 #include "../../Communication/RS485/LineHub/LineHub.h" 00009 #include "../../Communication/Controller/Controller.h" 00010 #include "../../Input/ExternalInt/ExternalInt.h" 00011 #include "../../Input/Switch/Switch.h" 00012 #include "../../Input/Potentiometer/Potentiometer.h" 00013 #include "../../Input/Encoder/Encoder.h" 00014 #include "../../LED/LED.h" 00015 #include "../../Safty/Safty.h" 00016 #include "../Using.h" 00017 00018 using namespace SWITCH; 00019 using namespace PID_SPACE; 00020 using namespace ENCODER; 00021 using namespace LINEHUB; 00022 00023 static CONTROLLER::ControllerData *controller; 00024 ACTUATORHUB::MOTOR::MotorStatus motor[MOUNTING_MOTOR_NUM]; 00025 ACTUATORHUB::SOLENOID::SolenoidStatus solenoid; 00026 00027 static bool lock; 00028 static bool processChangeComp; 00029 static int current; 00030 00031 static void AllActuatorReset(); 00032 00033 #ifdef USE_SUBPROCESS 00034 static void (*Process[USE_PROCESS_NUM])(void); 00035 #endif 00036 00037 #pragma region USER-DEFINED_VARIABLES_AND_PROTOTYPE 00038 00039 /*Replace here with the definition code of your variables.*/ 00040 00041 Serial pc(USBTX, USBRX); 00042 00043 //**************Encoder*************** 00044 const int PerRev = 256; 00045 QEI ECD_0(ECD_A_0,ECD_B_0,NC,PerRev,QEI::X4_ENCODING); 00046 QEI ECD_1(ECD_A_1,ECD_B_1,NC,PerRev,QEI::X4_ENCODING); 00047 QEI ECD_2(ECD_A_2,ECD_B_2,NC,PerRev,QEI::X4_ENCODING); 00048 QEI ECD_3(ECD_A_3,ECD_B_3,NC,PerRev,QEI::X4_ENCODING); 00049 //**************Encoder*************** 00050 00051 //**************Buzzer**************** 00052 //DigitalOut buzzer(BUZZER_PIN); 00053 void BuzzerTimer_func(); 00054 Ticker BuzzerTimer; 00055 bool EMGflag = false; 00056 //PWMOut buzzer(BUZZER_PIN); 00057 //**************Buzzer**************** 00058 00059 //************TapeLed***************** 00060 void TapeLedEms_func(); 00061 TapeLedData tapeLED; 00062 TapeLedData sendLedData; 00063 TapeLED_Mode ledMode = Normal; 00064 Ticker tapeLedTimer; 00065 //************TapaLed***************** 00066 00067 float tireProRPM[4]; 00068 float tireTarRPM[4]; 00069 float tirepwm[4]; 00070 00071 const int omni[15][15] = { 00072 { 0, 5, 21, 47, 83, 130, 187, 255, 255, 255, 255, 255, 255, 255, 255 }, 00073 { -5, 0, 5, 21, 47, 83, 130, 187, 193, 208, 234, 255, 255, 255, 255 }, 00074 { -21, -5, 0, 5, 21, 47, 83, 130, 135, 151, 177, 213, 255, 255, 255 }, 00075 { -47, -21, 5, 0, 5, 21, 47, 83, 88, 104, 130, 167, 213, 255, 255 }, 00076 { -83, -47, -21, 5, 0, 5, 21, 47, 52, 68, 94, 130, 177, 234, 255 }, 00077 { -130, -83, -47, -21, 5, 0, 5, 21, 26, 42, 68, 104, 151, 208, 255 }, 00078 { -187, -130, -83, -47, -21, -5, 0, 5, 10, 26, 52, 88, 135, 193, 255 }, 00079 { -255, -187, -130, -83, -47, -21, -5, 0, 5, 21, 47, 83, 130, 187, 255 }, 00080 { -255, -193, -135, -88, -52, -26, -10, -5, 0, 5, 21, 47, 83, 130, 187 }, 00081 { -255, -208, -151, -104, -68, -42, -26, -21, -5, 0, 5, 21, 47, 83, 130 }, 00082 { -255, -234, -177, -130, -94, -68, -52, -47, -21, -7, 0, 7, 21, 47, 83 }, 00083 { -255, -255, -213, -167, -130, -104, -88, -83, -47, -21, -5, 0, 5, 21, 47 }, 00084 { -255, -255, -255, -213, -177, -151, -135, -130, -83, -47, -21, -5, 0, 5, 21 }, 00085 { -255, -255, -255, -255, -234, -208, -193, -187, -130, -83, -47, -21, -5, 0, 5 }, 00086 { -255, -255, -255, -255, -255, -255, -255, -255, -187, -130, -83, -47, -21, -5, 0 } 00087 }; 00088 00089 const int curve[15] = { -152, -98, -54, -18, 0, 0, 0, 0, 0, 0, 0, 18, 54, 98, 152 }; 00090 //{-200,-146,-102,-66,-36,-16,0,0,0,16,36,66,102,146,200} 00091 00092 uint8_t SetStatus(int); 00093 uint8_t SetStatus(int pwmVal) 00094 { 00095 if (pwmVal < 0) return BACK; 00096 else if (pwmVal > 0) return FOR; 00097 else if (pwmVal == 0) return BRAKE; 00098 else return BRAKE; 00099 } 00100 uint8_t Setpwm(int); 00101 uint8_t Setpwm(int pwmVal) 00102 { 00103 if (pwmVal == 0 || pwmVal > 255 || pwmVal < -255) return 255; 00104 else return abs(pwmVal); 00105 } 00106 00107 void LedMode(int led) 00108 { 00109 /* 00110 switch(led) { 00111 case 1: 00112 POTENTIOMETER::dio[0]= 1; 00113 POTENTIOMETER::dio[1]= 0; 00114 POTENTIOMETER::dio[2]= 0; 00115 POTENTIOMETER::dio[3]= 0; 00116 break; 00117 case 2: 00118 POTENTIOMETER::dio[0]= 0; 00119 POTENTIOMETER::dio[1]= 1; 00120 POTENTIOMETER::dio[2]= 0; 00121 POTENTIOMETER::dio[3]= 0; 00122 break; 00123 case 3: 00124 POTENTIOMETER::dio[0]= 1; 00125 POTENTIOMETER::dio[1]= 1; 00126 POTENTIOMETER::dio[2]= 0; 00127 POTENTIOMETER::dio[3]= 0; 00128 break; 00129 case 4: 00130 POTENTIOMETER::dio[0]= 0; 00131 POTENTIOMETER::dio[1]= 0; 00132 POTENTIOMETER::dio[2]= 1; 00133 POTENTIOMETER::dio[3]= 0; 00134 break; 00135 } 00136 */ 00137 if(led/8>=1) { 00138 POTENTIOMETER::dio[3]= 1; 00139 led=led%8; 00140 } else { 00141 POTENTIOMETER::dio[3]= 0; 00142 } 00143 00144 if(led/4>=1) { 00145 POTENTIOMETER::dio[2]= 1; 00146 led=led%4; 00147 } else { 00148 POTENTIOMETER::dio[2]= 0; 00149 } 00150 00151 if(led/2>=1) { 00152 POTENTIOMETER::dio[1]= 1; 00153 led=led%2; 00154 } else { 00155 POTENTIOMETER::dio[1]= 0; 00156 } 00157 00158 if(led/1>=1) { 00159 POTENTIOMETER::dio[0]= 1; 00160 led=0; 00161 } else { 00162 POTENTIOMETER::dio[0]= 0; 00163 } 00164 } 00165 int Twsh; 00166 bool UP_flag = false; 00167 bool SW_flag = false; 00168 bool Air_flag = false; 00169 bool zyouge; 00170 bool zyougedo; 00171 bool dz1=true; 00172 bool dz1i=false; 00173 bool dz2=true; 00174 bool dz2i=false; 00175 bool dz3=true; 00176 bool dz3i=false; 00177 bool dz4=true; 00178 bool dz4i=false; 00179 bool zone; 00180 bool through=false; 00181 bool counts=false; 00182 bool mtc=false; 00183 bool mtc2 = false; 00184 00185 int mode =1; 00186 int cross=0;//十字数える用 00187 int cros=0; 00188 int count=100000;//wait代替え 00189 00190 ///*********PWM調整用*********/// 00191 int fast =60; 00192 int normal = 40; 00193 int slow = 20; 00194 00195 #pragma endregion USER-DEFINED_VARIABLES_AND_PROTOTYPE 00196 00197 #ifdef USE_SUBPROCESS 00198 #if USE_PROCESS_NUM>0 00199 static void Process0(void); 00200 #endif 00201 #if USE_PROCESS_NUM>1 00202 static void Process1(void); 00203 #endif 00204 #if USE_PROCESS_NUM>2 00205 static void Process2(void); 00206 #endif 00207 #if USE_PROCESS_NUM>3 00208 static void Process3(void); 00209 #endif 00210 #if USE_PROCESS_NUM>4 00211 static void Process4(void); 00212 #endif 00213 #if USE_PROCESS_NUM>5 00214 static void Process5(void); 00215 #endif 00216 #if USE_PROCESS_NUM>6 00217 static void Process6(void); 00218 #endif 00219 #if USE_PROCESS_NUM>7 00220 static void Process7(void); 00221 #endif 00222 #if USE_PROCESS_NUM>8 00223 static void Process8(void); 00224 #endif 00225 #if USE_PROCESS_NUM>9 00226 static void Process9(void); 00227 #endif 00228 #endif 00229 00230 void SystemProcessInitialize() 00231 { 00232 #pragma region USER-DEFINED_VARIABLE_INIT 00233 /*Replace here with the initialization code of your variables.*/ 00234 #pragma endregion USER-DEFINED_VARIABLE_INIT 00235 00236 lock = true; 00237 processChangeComp = true; 00238 current = DEFAULT_PROCESS; 00239 00240 #ifdef USE_SUBPROCESS 00241 #if USE_PROCESS_NUM>0 00242 Process[0] = Process0; 00243 #endif 00244 #if USE_PROCESS_NUM>1 00245 Process[1] = Process1; 00246 #endif 00247 #if USE_PROCESS_NUM>2 00248 Process[2] = Process2; 00249 #endif 00250 #if USE_PROCESS_NUM>3 00251 Process[3] = Process3; 00252 #endif 00253 #if USE_PROCESS_NUM>4 00254 Process[4] = Process4; 00255 #endif 00256 #if USE_PROCESS_NUM>5 00257 Process[5] = Process5; 00258 #endif 00259 #if USE_PROCESS_NUM>6 00260 Process[6] = Process6; 00261 #endif 00262 #if USE_PROCESS_NUM>7 00263 Process[7] = Process7; 00264 #endif 00265 #if USE_PROCESS_NUM>8 00266 Process[8] = Process8; 00267 #endif 00268 #if USE_PROCESS_NUM>9 00269 Process[9] = Process9; 00270 #endif 00271 #endif 00272 } 00273 00274 static void SystemProcessUpdate() 00275 { 00276 #ifdef USE_SUBPROCESS 00277 if(controller->Button.HOME) lock = false; 00278 00279 if(controller->Button.START && processChangeComp) { 00280 current++; 00281 if (USE_PROCESS_NUM < current) current = USE_PROCESS_NUM; 00282 processChangeComp = false; 00283 } else if(controller->Button.SELECT && processChangeComp) { 00284 current--; 00285 if (current < 0) current = 0; 00286 processChangeComp = false; 00287 } else if(!controller->Button.SELECT && !controller->Button.START) processChangeComp = true; 00288 #endif 00289 00290 #ifdef USE_MOTOR 00291 ACTUATORHUB::MOTOR::Motor::Update(motor); 00292 #endif 00293 00294 #ifdef USE_SOLENOID 00295 ACTUATORHUB::SOLENOID::Solenoid::Update(solenoid); 00296 #endif 00297 00298 #ifdef USE_RS485 00299 ACTUATORHUB::ActuatorHub::Update(); 00300 #endif 00301 00302 } 00303 00304 int g[8]; 00305 00306 void SystemProcess() 00307 { 00308 SystemProcessInitialize(); 00309 00310 while(1) { 00311 for(int i = 0; i < 8; i++) { 00312 g[i] = LineHub::GetPara(i); 00313 } 00314 00315 //printf("0:%d 1:%d 2:%d 3:%d 4:%d 5:%d 6:%d 9:%d\n\r",g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7]); 00316 00317 #ifdef USE_MU 00318 controller = CONTROLLER::Controller::GetData(); 00319 #endif 00320 00321 #ifdef USE_ERRORCHECK 00322 if(SAFTY::ErrorCheck::Check() & SAFTY::Error::ControllerLost) { 00323 CONTROLLER::Controller::DataReset(); 00324 AllActuatorReset(); 00325 lock = true; 00326 } else 00327 #endif 00328 { 00329 00330 #ifdef USE_SUBPROCESS 00331 if(!lock) { 00332 Process[current](); 00333 } else 00334 #endif 00335 { 00336 //ロック時の処理 00337 } 00338 } 00339 /* 00340 //Emergency! 00341 if(!EMG_0 && !EMG_1 && !EMGflag) { 00342 buzzer = 0; 00343 BuzzerTimer.attach(BuzzerTimer_func, 1); 00344 EMGflag = true; 00345 LED_DEBUG0 = 1; 00346 } 00347 if(EMG_0 && EMG_1 && EMGflag) { 00348 buzzer = 1; 00349 BuzzerTimer.detach(); 00350 EMGflag = false; 00351 } 00352 */ 00353 SystemProcessUpdate(); 00354 } 00355 } 00356 00357 #pragma region PROCESS 00358 #ifdef USE_SUBPROCESS 00359 #if USE_PROCESS_NUM>0 00360 static void Process0() 00361 { 00362 mode=1; 00363 LedMode(1); 00364 if(ThSW) { 00365 Twsh=1; 00366 } else { 00367 Twsh=2; 00368 } 00369 00370 if(StertSW) { 00371 if(ZoneSW) { 00372 mode=1; 00373 current = 2; 00374 } else { 00375 mode=1; 00376 current = 5; 00377 } 00378 } 00379 if(DWSW) { 00380 zyouge=true; 00381 } 00382 if(DOSW) { 00383 zyougedo=true; 00384 } 00385 if(AIRSW) { 00386 if(SW_flag==false) { 00387 if(Air_flag==false) { 00388 solenoid.solenoid3 = SOLENOID_ON; 00389 Air_flag=true; 00390 SW_flag=true; 00391 } else { 00392 solenoid.solenoid3 = SOLENOID_OFF; 00393 Air_flag=false; 00394 SW_flag=true; 00395 } 00396 } 00397 } else { 00398 SW_flag=false; 00399 } 00400 00401 if(zyouge) { 00402 if(Twsh==1) { 00403 motor[MOTOR_0].pwm = 220; 00404 motor[MOTOR_0].dir = FOR; 00405 if(UPLS) { 00406 motor[MOTOR_0].pwm = 100; 00407 motor[MOTOR_0].dir = BRAKE; 00408 zyouge=false; 00409 } 00410 } 00411 if(Twsh==2) { 00412 motor[MOTOR_0].pwm = 230; 00413 motor[MOTOR_0].dir = FOR; 00414 if(UPLS2) { 00415 motor[MOTOR_0].pwm = 100; 00416 motor[MOTOR_0].dir = BRAKE; 00417 zyouge=false; 00418 } 00419 } 00420 } 00421 if(zyougedo) { 00422 motor[MOTOR_0].pwm = 50; 00423 motor[MOTOR_0].dir = BACK; 00424 if(DOLS) { 00425 motor[MOTOR_0].pwm = 100; 00426 motor[MOTOR_0].dir = BRAKE; 00427 zyougedo=false; 00428 } 00429 } 00430 } 00431 00432 #endif 00433 00434 #if USE_PROCESS_NUM>1 00435 static void Process1() 00436 { 00437 mtc=false; 00438 mtc2 = false; 00439 LedMode(2); 00440 mode=1; 00441 cross=0; 00442 Twsh=1; 00443 motor[TIRE_FR].dir = SetStatus(-omni[controller->AnalogL.Y][14-controller->AnalogL.X] + curve[controller->AnalogR.X]); 00444 motor[TIRE_FL].dir = SetStatus(omni[controller->AnalogL.Y][controller->AnalogL.X] + curve[controller->AnalogR.X]); 00445 motor[TIRE_BR].dir = SetStatus(-omni[14-controller->AnalogL.X][14-controller->AnalogL.Y] + curve[controller->AnalogR.X]); 00446 motor[TIRE_BL].dir = SetStatus(omni[controller->AnalogL.X][14-controller->AnalogL.Y] + curve[controller->AnalogR.X]); 00447 00448 motor[TIRE_FR].pwm = Setpwm(omni[controller->AnalogL.Y][14-controller->AnalogL.X]+ curve[controller->AnalogR.X])*0.2; 00449 motor[TIRE_FL].pwm = Setpwm(omni[controller->AnalogL.Y][controller->AnalogL.X]+ curve[controller->AnalogR.X])*0.2; 00450 motor[TIRE_BR].pwm = Setpwm(omni[14-controller->AnalogL.X][14-controller->AnalogL.Y]+ curve[controller->AnalogR.X])*0.2; 00451 motor[TIRE_BL].pwm = Setpwm(omni[controller->AnalogL.X][14-controller->AnalogL.Y]+ curve[controller->AnalogR.X])*0.2; 00452 00453 if(controller->Button.UP||controller->Button.DOWN) { 00454 00455 if(controller->Button.UP) { 00456 motor[MOTOR_0].pwm =200; 00457 motor[MOTOR_0].dir = FOR; 00458 if(UPLS) { 00459 motor[MOTOR_0].pwm = 0; 00460 motor[MOTOR_0].dir = BRAKE; 00461 } 00462 } 00463 if(controller->Button.DOWN) { 00464 motor[MOTOR_0].pwm = 50; 00465 motor[MOTOR_0].dir = BACK; 00466 } 00467 } else { 00468 motor[MOTOR_0].pwm = 0; 00469 motor[MOTOR_0].dir = BRAKE; 00470 } 00471 00472 if(controller->Button.Y) { 00473 if(dz2==true) { 00474 if(dz2i==false) { 00475 solenoid.solenoid2 = SOLENOID_ON; 00476 dz2i=true; 00477 } else { 00478 solenoid.solenoid2 = SOLENOID_OFF; 00479 dz2i=false; 00480 } 00481 dz2=false; 00482 } 00483 } else { 00484 dz2=true; 00485 } 00486 00487 if(controller->Button.A) { 00488 if(dz3==true) { 00489 if(dz3i==false) { 00490 00491 dz3i=true; 00492 } else { 00493 solenoid.solenoid3 = SOLENOID_OFF; 00494 dz3i=false; 00495 } 00496 dz3=false; 00497 } 00498 } else { 00499 dz3=true; 00500 } 00501 00502 if(controller->Button.B) { 00503 if(dz4==true) { 00504 if(dz4i==false) { 00505 solenoid.solenoid4 = SOLENOID_ON; 00506 dz4i=true; 00507 } else { 00508 solenoid.solenoid4 = SOLENOID_OFF; 00509 dz4i=false; 00510 } 00511 dz4=false; 00512 } 00513 } else { 00514 dz4=true; 00515 } 00516 /* 00517 if(controller->Button.RIGHT){ 00518 motor[MOTOR_1].dir = FOR; 00519 motor[MOTOR_1].pwm = 60; 00520 if (ARM_1){ 00521 motor[MOTOR_1].dir = BRAKE; 00522 } 00523 } 00524 else if(controller->Button.LEFT){ 00525 motor[MOTOR_1].dir = BACK; 00526 motor[MOTOR_1].pwm = 60; 00527 if (ARM_0){ 00528 motor[MOTOR_1].dir = BRAKE; 00529 } 00530 } 00531 */ 00532 } 00533 #endif 00534 00535 #if USE_PROCESS_NUM>2 00536 static void Process2() 00537 { 00538 LedMode(3); 00539 // printf("1:%d 2:%d 3:%d 4:%d 5:%d 6:%d 7:%d 8:%d\n\r",g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7]); 00540 count++; 00541 if(mode==1) {//スタートゾーンから白線検知 00542 motor[TIRE_FR].pwm = normal; 00543 motor[TIRE_FR].dir = BACK; 00544 motor[TIRE_FL].pwm = normal; 00545 motor[TIRE_FL].dir = FOR; 00546 motor[TIRE_BR].pwm = normal; 00547 motor[TIRE_BR].dir = BACK; 00548 motor[TIRE_BL].pwm = normal; 00549 motor[TIRE_BL].dir = FOR; 00550 if(g[2]==0) { 00551 count=100000; 00552 cross=0; 00553 mode=3; 00554 } 00555 } else if(mode==3) { //横ライントレースから縦ライントレースへ 00556 motor[TIRE_FR].pwm = 0; 00557 motor[TIRE_FR].dir = FREE; 00558 motor[TIRE_FL].pwm = normal; 00559 motor[TIRE_FL].dir = FOR; 00560 motor[TIRE_BR].pwm = normal; 00561 motor[TIRE_BR].dir = BACK; 00562 motor[TIRE_BL].pwm = 0; 00563 motor[TIRE_BL].dir = FREE; 00564 if(g[0]==0) { 00565 mode=10; 00566 count=100000; 00567 } 00568 } else if(mode==10) { //縦ライントレース 00569 00570 if(counts==false&&g[2]==0) { 00571 cros++; 00572 counts=true; 00573 } 00574 if(counts==true&&g[2]==99) { 00575 counts=false; 00576 } 00577 00578 if(cros==Twsh) { 00579 mode=11; 00580 count=0; 00581 cros=0; 00582 }//ゆっくりモードに入れなかった時の保険 00583 switch(g[0]) { 00584 case 98: 00585 motor[TIRE_FR].pwm = normal; 00586 motor[TIRE_FR].dir = BACK; 00587 motor[TIRE_FL].pwm = normal; 00588 motor[TIRE_FL].dir = FOR; 00589 motor[TIRE_BR].pwm = normal; 00590 motor[TIRE_BR].dir = BACK; 00591 motor[TIRE_BL].pwm = normal; 00592 motor[TIRE_BL].dir = FOR; 00593 mtc=true; 00594 if(count>80000) { 00595 cross++; 00596 count=0; 00597 } 00598 if(cross==Twsh) { 00599 mode=11; 00600 count=0; 00601 cross=0; 00602 } 00603 break; 00604 case 0: 00605 motor[TIRE_FR].pwm = fast; 00606 motor[TIRE_FR].dir = BACK; 00607 motor[TIRE_FL].pwm = fast; 00608 motor[TIRE_FL].dir = FOR; 00609 motor[TIRE_BR].pwm = fast; 00610 motor[TIRE_BR].dir = BACK; 00611 motor[TIRE_BL].pwm = fast; 00612 motor[TIRE_BL].dir = FOR; 00613 mtc=true; 00614 break; 00615 case 255: 00616 motor[TIRE_FR].pwm = fast; 00617 motor[TIRE_FR].dir = BACK; 00618 motor[TIRE_FL].pwm = slow; 00619 motor[TIRE_FL].dir = FOR; 00620 motor[TIRE_BR].pwm = slow; 00621 motor[TIRE_BR].dir = BACK; 00622 motor[TIRE_BL].pwm = fast; 00623 motor[TIRE_BL].dir = FOR; 00624 mtc=true; 00625 break; 00626 case 253: 00627 motor[TIRE_FR].pwm = slow; 00628 motor[TIRE_FR].dir = BACK; 00629 motor[TIRE_FL].pwm = 0; 00630 motor[TIRE_FL].dir = FREE; 00631 motor[TIRE_BR].pwm = 0; 00632 motor[TIRE_BR].dir = FREE; 00633 motor[TIRE_BL].pwm = slow; 00634 motor[TIRE_BL].dir = FOR; 00635 mtc=true; 00636 break; 00637 case 254: 00638 motor[TIRE_FR].pwm = normal; 00639 motor[TIRE_FR].dir = BACK; 00640 motor[TIRE_FL].pwm = 0; 00641 motor[TIRE_FL].dir = FREE; 00642 motor[TIRE_BR].pwm = 0; 00643 motor[TIRE_BR].dir = FREE; 00644 motor[TIRE_BL].pwm = normal; 00645 motor[TIRE_BL].dir = FOR; 00646 mtc=true; 00647 break; 00648 case 1: 00649 motor[TIRE_FR].pwm = slow; 00650 motor[TIRE_FR].dir = BACK; 00651 motor[TIRE_FL].pwm = fast; 00652 motor[TIRE_FL].dir = FOR; 00653 motor[TIRE_BR].pwm = fast; 00654 motor[TIRE_BR].dir = BACK; 00655 motor[TIRE_BL].pwm = slow; 00656 motor[TIRE_BL].dir = FOR; 00657 mtc=true; 00658 break; 00659 case 3: 00660 motor[TIRE_FR].pwm = 0; 00661 motor[TIRE_FR].dir = FREE; 00662 motor[TIRE_FL].pwm = slow; 00663 motor[TIRE_FL].dir = FOR; 00664 motor[TIRE_BR].pwm = slow; 00665 motor[TIRE_BR].dir = BACK; 00666 motor[TIRE_BL].pwm = 0; 00667 motor[TIRE_BL].dir = FREE; 00668 mtc=true; 00669 break; 00670 case 2: 00671 motor[TIRE_FR].pwm = 0; 00672 motor[TIRE_FR].dir = FREE; 00673 motor[TIRE_FL].pwm = normal; 00674 motor[TIRE_FL].dir = FOR; 00675 motor[TIRE_BR].pwm = normal; 00676 motor[TIRE_BR].dir = BACK; 00677 motor[TIRE_BL].pwm = 0; 00678 motor[TIRE_BL].dir = FREE; 00679 mtc=true; 00680 break; 00681 } 00682 if(g[0]!=98&&mtc==true) { 00683 switch(g[1]) { 00684 case 0: 00685 mtc=false; 00686 break; 00687 case 255: 00688 motor[TIRE_BR].pwm += 5; 00689 mtc=false; 00690 break; 00691 case 253: 00692 motor[TIRE_BR].pwm += 10; 00693 mtc=false; 00694 break; 00695 case 254: 00696 motor[TIRE_BR].pwm += 20; 00697 motor[TIRE_BL].pwm = 0; 00698 mtc=false; 00699 break; 00700 case 1: 00701 motor[TIRE_BL].pwm += 5; 00702 mtc=false; 00703 break; 00704 case 3: 00705 motor[TIRE_BL].pwm += 10; 00706 mtc=false; 00707 break; 00708 case 2: 00709 motor[TIRE_BL].pwm += 20; 00710 motor[TIRE_BR].pwm = 0; 00711 mtc=false; 00712 break; 00713 } 00714 } 00715 } else if(mode==11) { 00716 motor[TIRE_FR].pwm = 0; 00717 motor[TIRE_FR].dir = FREE; 00718 motor[TIRE_FL].pwm = normal; 00719 motor[TIRE_FL].dir = FOR; 00720 motor[TIRE_BR].pwm = normal; 00721 motor[TIRE_BR].dir = BACK; 00722 motor[TIRE_BL].pwm = 0; 00723 motor[TIRE_BL].dir = FREE; 00724 if(g[2]==0) { 00725 count=0; 00726 cross=0; 00727 mode=20; 00728 } 00729 } else if(mode==20) { 00730 00731 if(Twsh==2) { 00732 solenoid.solenoid2 = SOLENOID_ON; 00733 } 00734 if(counts==false&&g[0]==0) { 00735 cros++; 00736 counts=true; 00737 } 00738 if(counts==true&&g[0]==99) { 00739 counts=false; 00740 } 00741 00742 if(cros==2) { 00743 00744 // mode=21; 00745 // count=0; 00746 // cros=0; 00747 }//ゆっくりモードに入れなかった時の保険 00748 00749 switch(g[2]) { 00750 case 98: 00751 motor[TIRE_FR].pwm = normal; 00752 motor[TIRE_FR].dir = FOR; 00753 motor[TIRE_FL].pwm = normal; 00754 motor[TIRE_FL].dir = FOR; 00755 motor[TIRE_BR].pwm = normal; 00756 motor[TIRE_BR].dir = BACK; 00757 motor[TIRE_BL].pwm = normal; 00758 motor[TIRE_BL].dir = BACK; 00759 if(count>80000) { 00760 cross++; 00761 count=0; 00762 } 00763 mtc2=true; 00764 if(cross==2) { 00765 mode=21; 00766 count=0; 00767 cross=0; 00768 } 00769 break; 00770 case 0: 00771 motor[TIRE_FR].pwm = fast; 00772 motor[TIRE_FR].dir = FOR; 00773 motor[TIRE_FL].pwm = fast; 00774 motor[TIRE_FL].dir = FOR; 00775 motor[TIRE_BR].pwm = fast; 00776 motor[TIRE_BR].dir = BACK; 00777 motor[TIRE_BL].pwm = fast; 00778 motor[TIRE_BL].dir = BACK; 00779 mtc2=true; 00780 break; 00781 case 255: 00782 motor[TIRE_FR].pwm = normal; 00783 motor[TIRE_FR].dir = FOR; 00784 motor[TIRE_FL].pwm = fast; 00785 motor[TIRE_FL].dir = FOR; 00786 motor[TIRE_BR].pwm = fast; 00787 motor[TIRE_BR].dir = BACK; 00788 motor[TIRE_BL].pwm = normal; 00789 motor[TIRE_BL].dir = BACK; 00790 mtc2=true; 00791 break; 00792 case 253: 00793 motor[TIRE_FR].pwm = 0; 00794 motor[TIRE_FR].dir = FREE; 00795 motor[TIRE_FL].pwm = slow; 00796 motor[TIRE_FL].dir = FOR; 00797 motor[TIRE_BR].pwm = slow; 00798 motor[TIRE_BR].dir = BACK; 00799 motor[TIRE_BL].pwm = 0; 00800 motor[TIRE_BL].dir = FREE; 00801 mtc2=true; 00802 break; 00803 case 254: 00804 motor[TIRE_FR].pwm = 0; 00805 motor[TIRE_FR].dir = FREE; 00806 motor[TIRE_FL].pwm = normal; 00807 motor[TIRE_FL].dir = FOR; 00808 motor[TIRE_BR].pwm = normal; 00809 motor[TIRE_BR].dir = BACK; 00810 motor[TIRE_BL].pwm = 0; 00811 motor[TIRE_BL].dir = FREE; 00812 mtc2=true; 00813 break; 00814 case 1: 00815 motor[TIRE_FR].pwm = fast; 00816 motor[TIRE_FR].dir = FOR; 00817 motor[TIRE_FL].pwm = slow; 00818 motor[TIRE_FL].dir = FOR; 00819 motor[TIRE_BR].pwm = slow; 00820 motor[TIRE_BR].dir = BACK; 00821 motor[TIRE_BL].pwm = fast; 00822 motor[TIRE_BL].dir = BACK; 00823 mtc2=true; 00824 break; 00825 case 3: 00826 motor[TIRE_FR].pwm = slow; 00827 motor[TIRE_FR].dir = FOR; 00828 motor[TIRE_FL].pwm = 0; 00829 motor[TIRE_FL].dir = FREE; 00830 motor[TIRE_BR].pwm = 0; 00831 motor[TIRE_BR].dir = FREE; 00832 motor[TIRE_BL].pwm = slow; 00833 motor[TIRE_BL].dir = BACK; 00834 mtc2=true; 00835 break; 00836 case 2: 00837 motor[TIRE_FR].pwm = normal; 00838 motor[TIRE_FR].dir = FOR; 00839 motor[TIRE_FL].pwm = 0; 00840 motor[TIRE_FL].dir = FREE; 00841 motor[TIRE_BR].pwm = 0; 00842 motor[TIRE_BR].dir = FREE; 00843 motor[TIRE_BL].pwm = normal; 00844 motor[TIRE_BL].dir = BACK; 00845 mtc2=true; 00846 break; 00847 } 00848 if(g[2]!=98&&mtc2==true) { 00849 switch(g[3]) { 00850 case 0: 00851 mtc2=false; 00852 break; 00853 case 255: 00854 motor[TIRE_BL].pwm += 5; 00855 mtc2=false; 00856 break; 00857 case 253: 00858 motor[TIRE_BL].pwm += 10; 00859 mtc2=false; 00860 break; 00861 case 254: 00862 motor[TIRE_BL].pwm += 20; 00863 motor[TIRE_FL].pwm = 0; 00864 mtc2=false; 00865 break; 00866 case 1: 00867 motor[TIRE_FL].pwm += 5; 00868 mtc2=false; 00869 break; 00870 case 3: 00871 motor[TIRE_FL].pwm += 10; 00872 mtc2=false; 00873 break; 00874 case 2: 00875 motor[TIRE_FL].pwm += 20; 00876 motor[TIRE_BL].pwm = 0; 00877 mtc2=false; 00878 break; 00879 } 00880 } 00881 } else if(mode==21) { 00882 motor[TIRE_FR].pwm = 0; 00883 motor[TIRE_FR].dir = FREE; 00884 motor[TIRE_FL].pwm = normal; 00885 motor[TIRE_FL].dir = FOR; 00886 motor[TIRE_BR].pwm = normal; 00887 motor[TIRE_BR].dir = BACK; 00888 motor[TIRE_BL].pwm = 0; 00889 motor[TIRE_BL].dir = FREE; 00890 if(g[0]==0) { 00891 mode=30; 00892 cros=0; 00893 zyouge=true; 00894 } 00895 } else if(mode==30) { 00896 motor[TIRE_FR].pwm = 62; 00897 motor[TIRE_FR].dir = BACK; 00898 motor[TIRE_FL].pwm = 60; 00899 motor[TIRE_FL].dir = FOR; 00900 motor[TIRE_BR].pwm = 60; 00901 motor[TIRE_BR].dir = BACK; 00902 motor[TIRE_BL].pwm = 62; 00903 motor[TIRE_BL].dir = FOR; 00904 if(g[0]==98) { 00905 mode=31; 00906 } 00907 if(g[3]==0) { 00908 mode=32; 00909 count=0; 00910 cros=0; 00911 }//ゆっくりモードに入れなかった時の保険 00912 /* 00913 if(g[0]==98) { 00914 if(Twsh==2) { 00915 solenoid.solenoid2 = SOLENOID_OFF; 00916 } 00917 mode=31; 00918 count=0; 00919 } 00920 switch(g[0]) { 00921 case 98: 00922 motor[TIRE_FR].pwm = 30; 00923 motor[TIRE_FR].dir = BACK; 00924 motor[TIRE_FL].pwm = 30; 00925 motor[TIRE_FL].dir = FOR; 00926 motor[TIRE_BR].pwm = 30; 00927 motor[TIRE_BR].dir = BACK; 00928 motor[TIRE_BL].pwm = 30; 00929 motor[TIRE_BL].dir = FOR; 00930 if(count>100000) { 00931 cross++; 00932 count=0; 00933 } 00934 mtc=true; 00935 if(cross==1) { 00936 if(Twsh==2) { 00937 solenoid.solenoid2 = SOLENOID_OFF; 00938 } 00939 mode=31; 00940 count=0; 00941 } 00942 break; 00943 case 0: 00944 motor[TIRE_FR].pwm = 80; 00945 motor[TIRE_FR].dir = BACK; 00946 motor[TIRE_FL].pwm = 80; 00947 motor[TIRE_FL].dir = FOR; 00948 motor[TIRE_BR].pwm = 80; 00949 motor[TIRE_BR].dir = BACK; 00950 motor[TIRE_BL].pwm = 80; 00951 motor[TIRE_BL].dir = FOR; 00952 mtc=true; 00953 break; 00954 case 255: 00955 motor[TIRE_FR].pwm = 80; 00956 motor[TIRE_FR].dir = BACK; 00957 motor[TIRE_FL].pwm = 40; 00958 motor[TIRE_FL].dir = FOR; 00959 motor[TIRE_BR].pwm = 40; 00960 motor[TIRE_BR].dir = BACK; 00961 motor[TIRE_BL].pwm = 80; 00962 motor[TIRE_BL].dir = FOR; 00963 mtc=true; 00964 break; 00965 case 253: 00966 motor[TIRE_FR].pwm = 80; 00967 motor[TIRE_FR].dir = BACK; 00968 motor[TIRE_FL].pwm = 0; 00969 motor[TIRE_FL].dir = FREE; 00970 motor[TIRE_BR].pwm = 0; 00971 motor[TIRE_BR].dir = FREE; 00972 motor[TIRE_BL].pwm = 40; 00973 motor[TIRE_BL].dir = FOR; 00974 mtc=true; 00975 break; 00976 case 254: 00977 motor[TIRE_FR].pwm = 50; 00978 motor[TIRE_FR].dir = BACK; 00979 motor[TIRE_FL].pwm = 0; 00980 motor[TIRE_FL].dir = FREE; 00981 motor[TIRE_BR].pwm = 0; 00982 motor[TIRE_BR].dir = FREE; 00983 motor[TIRE_BL].pwm = 50; 00984 motor[TIRE_BL].dir = FOR; 00985 mtc=true; 00986 break; 00987 case 1: 00988 motor[TIRE_FR].pwm = 40; 00989 motor[TIRE_FR].dir = BACK; 00990 motor[TIRE_FL].pwm = 80; 00991 motor[TIRE_FL].dir = FOR; 00992 motor[TIRE_BR].pwm = 80; 00993 motor[TIRE_BR].dir = BACK; 00994 motor[TIRE_BL].pwm = 40; 00995 motor[TIRE_BL].dir = FOR; 00996 mtc=true; 00997 break; 00998 case 3: 00999 motor[TIRE_FR].pwm = 0; 01000 motor[TIRE_FR].dir = FREE; 01001 motor[TIRE_FL].pwm = 40; 01002 motor[TIRE_FL].dir = FOR; 01003 motor[TIRE_BR].pwm = 40; 01004 motor[TIRE_BR].dir = BACK; 01005 motor[TIRE_BL].pwm = 0; 01006 motor[TIRE_BL].dir = FREE; 01007 mtc=true; 01008 break; 01009 case 2: 01010 motor[TIRE_FR].pwm = 0; 01011 motor[TIRE_FR].dir = FREE; 01012 motor[TIRE_FL].pwm = 50; 01013 motor[TIRE_FL].dir = FOR; 01014 motor[TIRE_BR].pwm = 50; 01015 motor[TIRE_BR].dir = BACK; 01016 motor[TIRE_BL].pwm = 0; 01017 motor[TIRE_BL].dir = FREE; 01018 mtc=true; 01019 break; 01020 } 01021 if(g[0]!=98&&mtc==true) { 01022 switch(g[1]) { 01023 case 0: 01024 mtc=false; 01025 break; 01026 case 255: 01027 motor[TIRE_BR].pwm += 5; 01028 mtc=false; 01029 break; 01030 case 253: 01031 motor[TIRE_BR].pwm += 10; 01032 mtc=false; 01033 break; 01034 case 254: 01035 motor[TIRE_BR].pwm += 20; 01036 motor[TIRE_BL].pwm = 0; 01037 mtc=false; 01038 break; 01039 case 1: 01040 motor[TIRE_BL].pwm += 5; 01041 mtc=false; 01042 break; 01043 case 3: 01044 motor[TIRE_BL].pwm += 10; 01045 mtc=false; 01046 break; 01047 case 2: 01048 motor[TIRE_BL].pwm += 20; 01049 motor[TIRE_BR].pwm = 0; 01050 mtc=false; 01051 break; 01052 } 01053 01054 } 01055 } else if(mode==31) { 01056 motor[TIRE_FR].pwm = 15; 01057 motor[TIRE_FR].dir = BACK; 01058 motor[TIRE_FL].pwm = 10; 01059 motor[TIRE_FL].dir = BACK; 01060 motor[TIRE_BR].pwm = 10; 01061 motor[TIRE_BR].dir = FOR; 01062 motor[TIRE_BL].pwm = 15; 01063 motor[TIRE_BL].dir = FOR; 01064 if(g[3]==0) { 01065 count=0; 01066 mode=40; 01067 } 01068 */ 01069 01070 } else if(mode==31) { 01071 motor[TIRE_FR].pwm = 15; 01072 motor[TIRE_FR].dir = BACK; 01073 motor[TIRE_FL].pwm = 15; 01074 motor[TIRE_FL].dir = FOR; 01075 motor[TIRE_BR].pwm = 15; 01076 motor[TIRE_BR].dir = BACK; 01077 motor[TIRE_BL].pwm = 15; 01078 motor[TIRE_BL].dir = FOR; 01079 if(g[3]==0) { 01080 count=0; 01081 mode=32; 01082 } 01083 } else if(mode==32) { 01084 motor[TIRE_FR].pwm = 30; 01085 motor[TIRE_FR].dir = FOR; 01086 motor[TIRE_FL].pwm = 30; 01087 motor[TIRE_FL].dir = BACK; 01088 motor[TIRE_BR].pwm = 30; 01089 motor[TIRE_BR].dir = FOR; 01090 motor[TIRE_BL].pwm = 30; 01091 motor[TIRE_BL].dir = BACK; 01092 if(g[3]==0) { 01093 count=0; 01094 if(Twsh==2) { 01095 solenoid.solenoid2 = SOLENOID_OFF; 01096 } 01097 mode=40; 01098 } 01099 } else if(mode==40) { 01100 if(LIB) { 01101 mode=42; 01102 } 01103 if(counts==false&&g[0]==0) { 01104 cros++; 01105 counts=true; 01106 } 01107 if(counts==true&&g[0]==99) { 01108 counts=false; 01109 } 01110 01111 if(cros==1) { 01112 // mode=41; 01113 //count=0; 01114 //cros=0; 01115 }//ゆっくりモードに入れなかった時の保険 01116 01117 switch(g[3]) { 01118 case 98: 01119 motor[TIRE_FR].pwm = normal; 01120 motor[TIRE_FR].dir = BACK; 01121 motor[TIRE_FL].pwm = normal; 01122 motor[TIRE_FL].dir = BACK; 01123 motor[TIRE_BR].pwm = normal; 01124 motor[TIRE_BR].dir = FOR; 01125 motor[TIRE_BL].pwm = normal; 01126 motor[TIRE_BL].dir = FOR; 01127 if(count>20000) { 01128 cross++; 01129 count=0; 01130 } 01131 mtc2=true; 01132 if(cross==2) { 01133 mode=41; 01134 count=0; 01135 cross=0; 01136 } 01137 break; 01138 case 0: 01139 motor[TIRE_FR].pwm = fast; 01140 motor[TIRE_FR].dir = BACK; 01141 motor[TIRE_FL].pwm = fast; 01142 motor[TIRE_FL].dir = BACK; 01143 motor[TIRE_BR].pwm = fast; 01144 motor[TIRE_BR].dir = FOR; 01145 motor[TIRE_BL].pwm = fast; 01146 motor[TIRE_BL].dir = FOR; 01147 mtc2=true; 01148 break; 01149 case 255: 01150 motor[TIRE_FR].pwm = slow; 01151 motor[TIRE_FR].dir = BACK; 01152 motor[TIRE_FL].pwm = fast; 01153 motor[TIRE_FL].dir = BACK; 01154 motor[TIRE_BR].pwm = fast; 01155 motor[TIRE_BR].dir = FOR; 01156 motor[TIRE_BL].pwm = slow; 01157 motor[TIRE_BL].dir = FOR; 01158 mtc2=true; 01159 break; 01160 case 253: 01161 motor[TIRE_FR].pwm = 0; 01162 motor[TIRE_FR].dir = FREE; 01163 motor[TIRE_FL].pwm = slow; 01164 motor[TIRE_FL].dir = BACK; 01165 motor[TIRE_BR].pwm = slow; 01166 motor[TIRE_BR].dir = FOR; 01167 motor[TIRE_BL].pwm = 0; 01168 motor[TIRE_BL].dir = FREE; 01169 mtc2=true; 01170 break; 01171 case 254: 01172 motor[TIRE_FR].pwm = 0; 01173 motor[TIRE_FR].dir = FREE; 01174 motor[TIRE_FL].pwm = normal; 01175 motor[TIRE_FL].dir = BACK; 01176 motor[TIRE_BR].pwm = normal; 01177 motor[TIRE_BR].dir = FOR; 01178 motor[TIRE_BL].pwm = 0; 01179 motor[TIRE_BL].dir = FREE; 01180 mtc2=true; 01181 break; 01182 case 1: 01183 motor[TIRE_FR].pwm = fast; 01184 motor[TIRE_FR].dir = BACK; 01185 motor[TIRE_FL].pwm = slow; 01186 motor[TIRE_FL].dir = BACK; 01187 motor[TIRE_BR].pwm = slow; 01188 motor[TIRE_BR].dir = FOR; 01189 motor[TIRE_BL].pwm = fast; 01190 motor[TIRE_BL].dir = FOR; 01191 mtc2=true; 01192 break; 01193 case 3: 01194 motor[TIRE_FR].pwm = slow; 01195 motor[TIRE_FR].dir = BACK; 01196 motor[TIRE_FL].pwm = 0; 01197 motor[TIRE_FL].dir = FREE; 01198 motor[TIRE_BR].pwm = 0; 01199 motor[TIRE_BR].dir = FREE; 01200 motor[TIRE_BL].pwm = slow; 01201 motor[TIRE_BL].dir = FOR; 01202 mtc2=true; 01203 break; 01204 case 2: 01205 motor[TIRE_FR].pwm = normal; 01206 motor[TIRE_FR].dir = BACK; 01207 motor[TIRE_FL].pwm = 0; 01208 motor[TIRE_FL].dir = FREE; 01209 motor[TIRE_BR].pwm = 0; 01210 motor[TIRE_BR].dir = FREE; 01211 motor[TIRE_BL].pwm = normal; 01212 motor[TIRE_BL].dir = FOR; 01213 mtc2=true; 01214 break; 01215 } 01216 if(g[2]!=98&&mtc2==true) { 01217 switch(g[2]) { 01218 case 0: 01219 mtc2=false; 01220 break; 01221 case 255: 01222 motor[TIRE_FL].pwm += 5; 01223 mtc2=false; 01224 break; 01225 case 253: 01226 motor[TIRE_FL].pwm += 10; 01227 mtc2=false; 01228 break; 01229 case 254: 01230 motor[TIRE_FL].pwm += 20; 01231 motor[TIRE_BL].pwm = 0; 01232 mtc2=false; 01233 break; 01234 case 1: 01235 motor[TIRE_BL].pwm += 5; 01236 mtc2=false; 01237 break; 01238 case 3: 01239 motor[TIRE_BL].pwm += 10; 01240 mtc2=false; 01241 break; 01242 case 2: 01243 motor[TIRE_BL].pwm += 20; 01244 motor[TIRE_FL].pwm = 0; 01245 mtc2=false; 01246 break; 01247 } 01248 } 01249 } else if(mode==41) { 01250 motor[TIRE_FR].pwm = 0; 01251 motor[TIRE_FR].dir = FREE; 01252 motor[TIRE_FL].pwm = 30; 01253 motor[TIRE_FL].dir = BACK; 01254 motor[TIRE_BR].pwm = 30; 01255 motor[TIRE_BR].dir = FOR; 01256 motor[TIRE_BL].pwm = 0; 01257 motor[TIRE_BL].dir = FREE; 01258 if(g[1]==0) { 01259 count=0; 01260 mode=70; 01261 } 01262 } else if(mode==42) { 01263 motor[TIRE_FR].pwm = 20; 01264 motor[TIRE_FR].dir = FOR; 01265 motor[TIRE_FL].pwm = 0; 01266 motor[TIRE_FL].dir = FREE; 01267 motor[TIRE_BR].pwm = 0; 01268 motor[TIRE_BR].dir = FREE; 01269 motor[TIRE_BL].pwm = 20; 01270 motor[TIRE_BL].dir = BACK; 01271 if(g[1]==0) { 01272 count=0; 01273 mode=70; 01274 } 01275 } else if(mode==70) { 01276 switch(g[1]) { 01277 case 99: 01278 if(count>=100000) { 01279 mode=100; 01280 } 01281 break; 01282 case 98: 01283 motor[TIRE_FR].pwm = normal; 01284 motor[TIRE_FR].dir = FOR; 01285 motor[TIRE_FL].pwm = normal; 01286 motor[TIRE_FL].dir = BACK; 01287 motor[TIRE_BR].pwm = normal; 01288 motor[TIRE_BR].dir = FOR; 01289 motor[TIRE_BL].pwm = normal; 01290 motor[TIRE_BL].dir = BACK; 01291 break; 01292 case 0: 01293 motor[TIRE_FR].pwm = 80; 01294 motor[TIRE_FR].dir = FOR; 01295 motor[TIRE_FL].pwm = 80; 01296 motor[TIRE_FL].dir = BACK; 01297 motor[TIRE_BR].pwm = 80; 01298 motor[TIRE_BR].dir = FOR; 01299 motor[TIRE_BL].pwm = 80; 01300 motor[TIRE_BL].dir = BACK; 01301 mtc=true; 01302 break; 01303 case 255: 01304 motor[TIRE_FR].pwm = fast; 01305 motor[TIRE_FR].dir = FOR; 01306 motor[TIRE_FL].pwm = slow; 01307 motor[TIRE_FL].dir = BACK; 01308 motor[TIRE_BR].pwm = slow; 01309 motor[TIRE_BR].dir = FOR; 01310 motor[TIRE_BL].pwm = fast; 01311 motor[TIRE_BL].dir = BACK; 01312 mtc=true; 01313 break; 01314 case 253: 01315 motor[TIRE_FR].pwm = slow; 01316 motor[TIRE_FR].dir = FOR; 01317 motor[TIRE_FL].pwm = 0; 01318 motor[TIRE_FL].dir = FREE; 01319 motor[TIRE_BR].pwm = 0; 01320 motor[TIRE_BR].dir = FREE; 01321 motor[TIRE_BL].pwm = slow; 01322 motor[TIRE_BL].dir = BACK; 01323 mtc=true; 01324 break; 01325 case 254: 01326 motor[TIRE_FR].pwm = normal; 01327 motor[TIRE_FR].dir = FOR; 01328 motor[TIRE_FL].pwm = 0; 01329 motor[TIRE_FL].dir = FREE; 01330 motor[TIRE_BR].pwm = 0; 01331 motor[TIRE_BR].dir = FREE; 01332 motor[TIRE_BL].pwm = normal; 01333 motor[TIRE_BL].dir = BACK; 01334 mtc=true; 01335 break; 01336 case 1: 01337 motor[TIRE_FR].pwm = slow; 01338 motor[TIRE_FR].dir = FOR; 01339 motor[TIRE_FL].pwm = fast; 01340 motor[TIRE_FL].dir = BACK; 01341 motor[TIRE_BR].pwm = fast; 01342 motor[TIRE_BR].dir = FOR; 01343 motor[TIRE_BL].pwm = slow; 01344 motor[TIRE_BL].dir = BACK; 01345 mtc=true; 01346 break; 01347 case 3: 01348 motor[TIRE_FR].pwm = 0; 01349 motor[TIRE_FR].dir = FREE; 01350 motor[TIRE_FL].pwm = slow; 01351 motor[TIRE_FL].dir = BACK; 01352 motor[TIRE_BR].pwm = slow; 01353 motor[TIRE_BR].dir = FOR; 01354 motor[TIRE_BL].pwm = 0; 01355 motor[TIRE_BL].dir = FREE; 01356 mtc=true; 01357 break; 01358 case 2: 01359 motor[TIRE_FR].pwm = 0; 01360 motor[TIRE_FR].dir = FREE; 01361 motor[TIRE_FL].pwm = normal; 01362 motor[TIRE_FL].dir = BACK; 01363 motor[TIRE_BR].pwm = normal; 01364 motor[TIRE_BR].dir = FOR; 01365 motor[TIRE_BL].pwm = 0; 01366 motor[TIRE_BL].dir = FREE; 01367 mtc=true; 01368 break; 01369 } 01370 if(g[1]!=98&&mtc==true) { 01371 switch(g[0]) { 01372 case 0: 01373 mtc=false; 01374 break; 01375 case 255: 01376 motor[TIRE_FL].pwm += 5; 01377 mtc=false; 01378 break; 01379 case 253: 01380 motor[TIRE_FL].pwm += 10; 01381 mtc=false; 01382 break; 01383 case 254: 01384 motor[TIRE_FL].pwm += 20; 01385 motor[TIRE_FR].pwm = 0; 01386 mtc=false; 01387 break; 01388 case 1: 01389 motor[TIRE_FR].pwm += 5; 01390 mtc=false; 01391 break; 01392 case 3: 01393 motor[TIRE_FR].pwm += 10; 01394 mtc=false; 01395 break; 01396 case 2: 01397 motor[TIRE_FR].pwm += 20; 01398 motor[TIRE_FL].pwm = 0; 01399 mtc=false; 01400 break; 01401 } 01402 } 01403 } else if(mode==100) { 01404 motor[TIRE_FR].pwm = 20; 01405 motor[TIRE_FR].dir = FOR; 01406 motor[TIRE_FL].pwm = 20; 01407 motor[TIRE_FL].dir = BACK; 01408 motor[TIRE_BR].pwm = 23; 01409 motor[TIRE_BR].dir = FOR; 01410 motor[TIRE_BL].pwm = 20; 01411 motor[TIRE_BL].dir = BACK; 01412 } else { 01413 motor[TIRE_FR].pwm = 0; 01414 motor[TIRE_FR].dir = BRAKE; 01415 motor[TIRE_FL].pwm = 0; 01416 motor[TIRE_FL].dir = BRAKE; 01417 motor[TIRE_BR].pwm = 0; 01418 motor[TIRE_BR].dir = BRAKE; 01419 motor[TIRE_BL].pwm = 0; 01420 motor[TIRE_BL].dir = BRAKE; 01421 } 01422 } 01423 #endif 01424 01425 #if USE_PROCESS_NUM>3 01426 static void Process3() 01427 { 01428 01429 } 01430 #endif 01431 01432 #if USE_PROCESS_NUM>4 01433 static void Process4() 01434 { 01435 LedMode(4); 01436 count++; 01437 if(mode==1) {//スタートゾーンから白線検知 01438 motor[TIRE_FR].pwm = 40; 01439 motor[TIRE_FR].dir = FOR; 01440 motor[TIRE_FL].pwm = 40; 01441 motor[TIRE_FL].dir = BACK; 01442 motor[TIRE_BR].pwm = 40; 01443 motor[TIRE_BR].dir = FOR; 01444 motor[TIRE_BL].pwm = 45; 01445 motor[TIRE_BL].dir = BACK; 01446 if(g[2]==0) { 01447 count=100000; 01448 cross=0; 01449 mode=3; 01450 } 01451 } else if(mode==3) { //横ライントレースから縦ライントレースへ 01452 motor[TIRE_FR].pwm = 40; 01453 motor[TIRE_FR].dir = FOR; 01454 motor[TIRE_FL].pwm = 0; 01455 motor[TIRE_FL].dir = FREE; 01456 motor[TIRE_BR].pwm = 0; 01457 motor[TIRE_BR].dir = FREE; 01458 motor[TIRE_BL].pwm = 40; 01459 motor[TIRE_BL].dir = BACK; 01460 if(g[0]==0) { 01461 mode=10; 01462 count=100000; 01463 } 01464 } else if(mode==10) { //縦ライントレース 01465 01466 if(counts==false&&g[2]==0) { 01467 cros++; 01468 counts=true; 01469 } 01470 if(counts==true&&g[2]==99) { 01471 counts=false; 01472 } 01473 01474 if(cros==Twsh) { 01475 mode=11; 01476 count=0; 01477 cros=0; 01478 }//ゆっくりモードに入れなかった時の保険 01479 switch(g[1]) { 01480 case 98: 01481 motor[TIRE_FR].pwm = normal; 01482 motor[TIRE_FR].dir = FOR; 01483 motor[TIRE_FL].pwm = normal; 01484 motor[TIRE_FL].dir = BACK; 01485 motor[TIRE_BR].pwm = normal; 01486 motor[TIRE_BR].dir = FOR; 01487 motor[TIRE_BL].pwm = normal; 01488 motor[TIRE_BL].dir = BACK; 01489 mtc=true; 01490 if(count>80000) { 01491 cross++; 01492 count=0; 01493 } 01494 if(cross==Twsh) { 01495 mode=11; 01496 count=0; 01497 cross=0; 01498 } 01499 break; 01500 case 0: 01501 motor[TIRE_FR].pwm = fast; 01502 motor[TIRE_FR].dir = FOR; 01503 motor[TIRE_FL].pwm = fast; 01504 motor[TIRE_FL].dir = BACK; 01505 motor[TIRE_BR].pwm = fast; 01506 motor[TIRE_BR].dir = FOR; 01507 motor[TIRE_BL].pwm = fast; 01508 motor[TIRE_BL].dir = BACK; 01509 mtc=true; 01510 break; 01511 case 255: 01512 motor[TIRE_FR].pwm = fast; 01513 motor[TIRE_FR].dir = FOR; 01514 motor[TIRE_FL].pwm = slow; 01515 motor[TIRE_FL].dir = BACK; 01516 motor[TIRE_BR].pwm = slow; 01517 motor[TIRE_BR].dir = FOR; 01518 motor[TIRE_BL].pwm = fast; 01519 motor[TIRE_BL].dir = BACK; 01520 mtc=true; 01521 break; 01522 case 253: 01523 motor[TIRE_FR].pwm = slow; 01524 motor[TIRE_FR].dir = FOR; 01525 motor[TIRE_FL].pwm = 0; 01526 motor[TIRE_FL].dir = FREE; 01527 motor[TIRE_BR].pwm = 0; 01528 motor[TIRE_BR].dir = FREE; 01529 motor[TIRE_BL].pwm = slow; 01530 motor[TIRE_BL].dir = BACK; 01531 mtc=true; 01532 break; 01533 case 254: 01534 motor[TIRE_FR].pwm = normal; 01535 motor[TIRE_FR].dir = FOR; 01536 motor[TIRE_FL].pwm = 0; 01537 motor[TIRE_FL].dir = FREE; 01538 motor[TIRE_BR].pwm = 0; 01539 motor[TIRE_BR].dir = FREE; 01540 motor[TIRE_BL].pwm = normal; 01541 motor[TIRE_BL].dir = BACK; 01542 mtc=true; 01543 break; 01544 case 1: 01545 motor[TIRE_FR].pwm = slow; 01546 motor[TIRE_FR].dir = FOR; 01547 motor[TIRE_FL].pwm = fast; 01548 motor[TIRE_FL].dir = BACK; 01549 motor[TIRE_BR].pwm = fast; 01550 motor[TIRE_BR].dir = FOR; 01551 motor[TIRE_BL].pwm = slow; 01552 motor[TIRE_BL].dir = BACK; 01553 mtc=true; 01554 break; 01555 case 3: 01556 motor[TIRE_FR].pwm = 0; 01557 motor[TIRE_FR].dir = FREE; 01558 motor[TIRE_FL].pwm = slow; 01559 motor[TIRE_FL].dir = BACK; 01560 motor[TIRE_BR].pwm = slow; 01561 motor[TIRE_BR].dir = FOR; 01562 motor[TIRE_BL].pwm = 0; 01563 motor[TIRE_BL].dir = FREE; 01564 mtc=true; 01565 break; 01566 case 2: 01567 motor[TIRE_FR].pwm = 0; 01568 motor[TIRE_FR].dir = FREE; 01569 motor[TIRE_FL].pwm = normal; 01570 motor[TIRE_FL].dir = BACK; 01571 motor[TIRE_BR].pwm = normal; 01572 motor[TIRE_BR].dir = FOR; 01573 motor[TIRE_BL].pwm = 0; 01574 motor[TIRE_BL].dir = FREE; 01575 mtc=true; 01576 break; 01577 } 01578 if(g[0]!=98&&mtc==true) { 01579 switch(g[0]) { 01580 case 0: 01581 mtc=false; 01582 break; 01583 case 255: 01584 motor[TIRE_FL].pwm += 5; 01585 mtc=false; 01586 break; 01587 case 253: 01588 motor[TIRE_FL].pwm += 10; 01589 mtc=false; 01590 break; 01591 case 254: 01592 motor[TIRE_FL].pwm += 20; 01593 motor[TIRE_FR].pwm = 0; 01594 mtc=false; 01595 break; 01596 case 1: 01597 motor[TIRE_FR].pwm += 5; 01598 mtc=false; 01599 break; 01600 case 3: 01601 motor[TIRE_FR].pwm += 10; 01602 mtc=false; 01603 break; 01604 case 2: 01605 motor[TIRE_FR].pwm += 20; 01606 motor[TIRE_FL].pwm = 0; 01607 mtc=false; 01608 break; 01609 } 01610 } 01611 } else if(mode==11) { 01612 motor[TIRE_FR].pwm = normal; 01613 motor[TIRE_FR].dir = FOR; 01614 motor[TIRE_FL].pwm = 0; 01615 motor[TIRE_FL].dir = FREE; 01616 motor[TIRE_BR].pwm = 0; 01617 motor[TIRE_BR].dir = FREE; 01618 motor[TIRE_BL].pwm = normal; 01619 motor[TIRE_BL].dir = BACK; 01620 if(g[2]==0) { 01621 count=0; 01622 cross=0; 01623 mode=20; 01624 fast=40; 01625 normal=30; 01626 slow=20; 01627 } 01628 } else if(mode==20) { 01629 01630 if(Twsh==2) { 01631 solenoid.solenoid2 = SOLENOID_ON; 01632 } 01633 01634 if(counts==false&&g[1]==0) { 01635 cros++; 01636 counts=true; 01637 } 01638 if(counts==true&&g[1]==99) { 01639 counts=false; 01640 } 01641 01642 if(cros==2) { 01643 //mode=21; 01644 //count=0; 01645 //cros=0; 01646 }//ゆっくりモードに入れなかった時の保険 01647 01648 switch(g[2]) { 01649 case 98: 01650 motor[TIRE_FR].pwm = normal; 01651 motor[TIRE_FR].dir = FOR; 01652 motor[TIRE_FL].pwm = normal; 01653 motor[TIRE_FL].dir = FOR; 01654 motor[TIRE_BR].pwm = normal; 01655 motor[TIRE_BR].dir = BACK; 01656 motor[TIRE_BL].pwm = normal; 01657 motor[TIRE_BL].dir = BACK; 01658 if(count>80000) { 01659 cross++; 01660 count=0; 01661 } 01662 mtc2=true; 01663 if(cross==2) { 01664 mode=21; 01665 count=0; 01666 cross=0; 01667 } 01668 break; 01669 case 0: 01670 motor[TIRE_FR].pwm = fast; 01671 motor[TIRE_FR].dir = FOR; 01672 motor[TIRE_FL].pwm = fast; 01673 motor[TIRE_FL].dir = FOR; 01674 motor[TIRE_BR].pwm = fast; 01675 motor[TIRE_BR].dir = BACK; 01676 motor[TIRE_BL].pwm = fast; 01677 motor[TIRE_BL].dir = BACK; 01678 mtc2=true; 01679 break; 01680 case 255: 01681 motor[TIRE_FR].pwm = normal; 01682 motor[TIRE_FR].dir = FOR; 01683 motor[TIRE_FL].pwm = fast; 01684 motor[TIRE_FL].dir = FOR; 01685 motor[TIRE_BR].pwm = fast; 01686 motor[TIRE_BR].dir = BACK; 01687 motor[TIRE_BL].pwm = normal; 01688 motor[TIRE_BL].dir = BACK; 01689 mtc2=true; 01690 break; 01691 case 253: 01692 motor[TIRE_FR].pwm = 0; 01693 motor[TIRE_FR].dir = FREE; 01694 motor[TIRE_FL].pwm = slow; 01695 motor[TIRE_FL].dir = FOR; 01696 motor[TIRE_BR].pwm = slow; 01697 motor[TIRE_BR].dir = BACK; 01698 motor[TIRE_BL].pwm = 0; 01699 motor[TIRE_BL].dir = FREE; 01700 mtc2=true; 01701 break; 01702 case 254: 01703 motor[TIRE_FR].pwm = 0; 01704 motor[TIRE_FR].dir = FREE; 01705 motor[TIRE_FL].pwm = normal; 01706 motor[TIRE_FL].dir = FOR; 01707 motor[TIRE_BR].pwm = normal; 01708 motor[TIRE_BR].dir = BACK; 01709 motor[TIRE_BL].pwm = 0; 01710 motor[TIRE_BL].dir = FREE; 01711 mtc2=true; 01712 break; 01713 case 1: 01714 motor[TIRE_FR].pwm = fast; 01715 motor[TIRE_FR].dir = FOR; 01716 motor[TIRE_FL].pwm = slow; 01717 motor[TIRE_FL].dir = FOR; 01718 motor[TIRE_BR].pwm = slow; 01719 motor[TIRE_BR].dir = BACK; 01720 motor[TIRE_BL].pwm = fast; 01721 motor[TIRE_BL].dir = BACK; 01722 mtc2=true; 01723 break; 01724 case 3: 01725 motor[TIRE_FR].pwm = slow; 01726 motor[TIRE_FR].dir = FOR; 01727 motor[TIRE_FL].pwm = 0; 01728 motor[TIRE_FL].dir = FREE; 01729 motor[TIRE_BR].pwm = 0; 01730 motor[TIRE_BR].dir = FREE; 01731 motor[TIRE_BL].pwm = slow; 01732 motor[TIRE_BL].dir = BACK; 01733 mtc2=true; 01734 break; 01735 case 2: 01736 motor[TIRE_FR].pwm = normal; 01737 motor[TIRE_FR].dir = FOR; 01738 motor[TIRE_FL].pwm = 0; 01739 motor[TIRE_FL].dir = FREE; 01740 motor[TIRE_BR].pwm = 0; 01741 motor[TIRE_BR].dir = FREE; 01742 motor[TIRE_BL].pwm = normal; 01743 motor[TIRE_BL].dir = BACK; 01744 mtc2=true; 01745 break; 01746 } 01747 if(g[2]!=98&&mtc2==true) { 01748 switch(g[3]) { 01749 case 0: 01750 mtc2=false; 01751 break; 01752 case 255: 01753 motor[TIRE_BL].pwm += 5; 01754 mtc2=false; 01755 break; 01756 case 253: 01757 motor[TIRE_BL].pwm += 10; 01758 mtc2=false; 01759 break; 01760 case 254: 01761 motor[TIRE_BL].pwm += 20; 01762 motor[TIRE_FL].pwm = 0; 01763 mtc2=false; 01764 break; 01765 case 1: 01766 motor[TIRE_FL].pwm += 5; 01767 mtc2=false; 01768 break; 01769 case 3: 01770 motor[TIRE_FL].pwm += 10; 01771 mtc2=false; 01772 break; 01773 case 2: 01774 motor[TIRE_FL].pwm += 20; 01775 motor[TIRE_BL].pwm = 0; 01776 mtc2=false; 01777 break; 01778 } 01779 } 01780 } else if(mode==21) { 01781 motor[TIRE_FR].pwm = normal; 01782 motor[TIRE_FR].dir = FOR; 01783 motor[TIRE_FL].pwm = 0; 01784 motor[TIRE_FL].dir = FREE; 01785 motor[TIRE_BR].pwm = 0; 01786 motor[TIRE_BR].dir = FREE; 01787 motor[TIRE_BL].pwm = normal; 01788 motor[TIRE_BL].dir = BACK; 01789 if(g[1]==0) { 01790 mode=30; 01791 cros=0; 01792 zyouge=true; 01793 fast=80; 01794 normal=60; 01795 slow=40; 01796 } 01797 } else if(mode==30) { 01798 motor[TIRE_FR].pwm = 60; 01799 motor[TIRE_FR].dir = FOR; 01800 motor[TIRE_FL].pwm = 60; 01801 motor[TIRE_FL].dir = BACK; 01802 motor[TIRE_BR].pwm = 60; 01803 motor[TIRE_BR].dir = FOR; 01804 motor[TIRE_BL].pwm = 50; 01805 motor[TIRE_BL].dir = BACK; 01806 if(g[1]==98) { 01807 mode=31; 01808 } 01809 if(g[3]==0) { 01810 mode=32; 01811 count=0; 01812 cros=0; 01813 }//ゆっくりモードに入れなかった時の保険 01814 /* 01815 switch(g[1]) { 01816 case 98: 01817 motor[TIRE_FR].pwm = 30; 01818 motor[TIRE_FR].dir = FOR; 01819 motor[TIRE_FL].pwm = 30; 01820 motor[TIRE_FL].dir = BACK; 01821 motor[TIRE_BR].pwm = 30; 01822 motor[TIRE_BR].dir = FOR; 01823 motor[TIRE_BL].pwm = 30; 01824 motor[TIRE_BL].dir = BACK; 01825 if(count>100000) { 01826 cross++; 01827 count=0; 01828 } 01829 mtc=true; 01830 if(cross==1) { 01831 if(Twsh==2) { 01832 solenoid.solenoid2 = SOLENOID_OFF; 01833 } 01834 mode=31; 01835 count=0; 01836 } 01837 break; 01838 case 0: 01839 motor[TIRE_FR].pwm = 60; 01840 motor[TIRE_FR].dir = FOR; 01841 motor[TIRE_FL].pwm = 60; 01842 motor[TIRE_FL].dir = BACK; 01843 motor[TIRE_BR].pwm = 60; 01844 motor[TIRE_BR].dir = FOR; 01845 motor[TIRE_BL].pwm = 60; 01846 motor[TIRE_BL].dir = BACK; 01847 mtc=true; 01848 break; 01849 case 255: 01850 motor[TIRE_FR].pwm = 60; 01851 motor[TIRE_FR].dir = FOR; 01852 motor[TIRE_FL].pwm = 20; 01853 motor[TIRE_FL].dir = BACK; 01854 motor[TIRE_BR].pwm = 20; 01855 motor[TIRE_BR].dir = FOR; 01856 motor[TIRE_BL].pwm = 60; 01857 motor[TIRE_BL].dir = BACK; 01858 mtc=true; 01859 break; 01860 case 253: 01861 motor[TIRE_FR].pwm = 20; 01862 motor[TIRE_FR].dir = FOR; 01863 motor[TIRE_FL].pwm = 0; 01864 motor[TIRE_FL].dir = BACK; 01865 motor[TIRE_BR].pwm = 0; 01866 motor[TIRE_BR].dir = FOR; 01867 motor[TIRE_BL].pwm = 20; 01868 motor[TIRE_BL].dir = BACK; 01869 mtc=true; 01870 break; 01871 case 254: 01872 motor[TIRE_FR].pwm = 30; 01873 motor[TIRE_FR].dir = FOR; 01874 motor[TIRE_FL].pwm = 0; 01875 motor[TIRE_FL].dir = FREE; 01876 motor[TIRE_BR].pwm = 0; 01877 motor[TIRE_BR].dir = FREE; 01878 motor[TIRE_BL].pwm = 30; 01879 motor[TIRE_BL].dir = BACK; 01880 mtc=true; 01881 break; 01882 case 1: 01883 motor[TIRE_FR].pwm = 20; 01884 motor[TIRE_FR].dir = FOR; 01885 motor[TIRE_FL].pwm = 60; 01886 motor[TIRE_FL].dir = BACK; 01887 motor[TIRE_BR].pwm = 60; 01888 motor[TIRE_BR].dir = FOR; 01889 motor[TIRE_BL].pwm = 20; 01890 motor[TIRE_BL].dir = BACK; 01891 mtc=true; 01892 break; 01893 case 3: 01894 motor[TIRE_FR].pwm = 0; 01895 motor[TIRE_FR].dir = FREE; 01896 motor[TIRE_FL].pwm = 20; 01897 motor[TIRE_FL].dir = BACK; 01898 motor[TIRE_BR].pwm = 20; 01899 motor[TIRE_BR].dir = FOR; 01900 motor[TIRE_BL].pwm = 0; 01901 motor[TIRE_BL].dir = FREE; 01902 mtc=true; 01903 break; 01904 case 2: 01905 motor[TIRE_FR].pwm = 0; 01906 motor[TIRE_FR].dir = FREE; 01907 motor[TIRE_FL].pwm = 30; 01908 motor[TIRE_FL].dir = BACK; 01909 motor[TIRE_BR].pwm = 30; 01910 motor[TIRE_BR].dir = FOR; 01911 motor[TIRE_BL].pwm = 0; 01912 motor[TIRE_BL].dir = FREE; 01913 mtc=true; 01914 break; 01915 } 01916 if(g[1]!=98&&mtc==true) { 01917 switch(g[0]) { 01918 case 0: 01919 mtc=false; 01920 break; 01921 case 255: 01922 motor[TIRE_FL].pwm += 5; 01923 mtc=false; 01924 break; 01925 case 253: 01926 motor[TIRE_FL].pwm += 10; 01927 mtc=false; 01928 break; 01929 case 254: 01930 motor[TIRE_FL].pwm += 20; 01931 motor[TIRE_FR].pwm = 0; 01932 mtc=false; 01933 break; 01934 case 1: 01935 motor[TIRE_FR].pwm += 5; 01936 mtc=false; 01937 break; 01938 case 3: 01939 motor[TIRE_FR].pwm += 10; 01940 mtc=false; 01941 break; 01942 case 2: 01943 motor[TIRE_FR].pwm += 20; 01944 motor[TIRE_FL].pwm = 0; 01945 mtc=false; 01946 break; 01947 } 01948 } 01949 */ 01950 } else if(mode==31) { 01951 motor[TIRE_FR].pwm = 15; 01952 motor[TIRE_FR].dir = FOR; 01953 motor[TIRE_FL].pwm = 15; 01954 motor[TIRE_FL].dir = BACK; 01955 motor[TIRE_BR].pwm = 15; 01956 motor[TIRE_BR].dir = FOR; 01957 motor[TIRE_BL].pwm = 15; 01958 motor[TIRE_BL].dir = BACK; 01959 if(g[3]==0) { 01960 count=0; 01961 mode=32; 01962 } 01963 } else if(mode==32) { 01964 motor[TIRE_FR].pwm = 30; 01965 motor[TIRE_FR].dir = BACK; 01966 motor[TIRE_FL].pwm = 30; 01967 motor[TIRE_FL].dir = FOR; 01968 motor[TIRE_BR].pwm = 30; 01969 motor[TIRE_BR].dir = BACK; 01970 motor[TIRE_BL].pwm = 30; 01971 motor[TIRE_BL].dir = FOR; 01972 if(g[3]==0) { 01973 count=0; 01974 if(Twsh==2) { 01975 solenoid.solenoid2 = SOLENOID_OFF; 01976 } 01977 mode=40; 01978 } 01979 } else if(mode==40) { 01980 01981 if(LIF) { 01982 mode=42; 01983 } 01984 01985 if(counts==false&&g[0]==0) { 01986 cros++; 01987 counts=true; 01988 } 01989 if(counts==true&&g[0]==99) { 01990 counts=false; 01991 } 01992 01993 if(cros==1) { 01994 // mode=41; 01995 //count=0; 01996 //cros=0; 01997 }//ゆっくりモードに入れなかった時の保険 01998 01999 switch(g[3]) { 02000 case 98: 02001 motor[TIRE_FR].pwm = normal; 02002 motor[TIRE_FR].dir = BACK; 02003 motor[TIRE_FL].pwm = normal; 02004 motor[TIRE_FL].dir = BACK; 02005 motor[TIRE_BR].pwm = normal; 02006 motor[TIRE_BR].dir = FOR; 02007 motor[TIRE_BL].pwm = normal; 02008 motor[TIRE_BL].dir = FOR; 02009 if(count>20000) { 02010 cross++; 02011 count=0; 02012 } 02013 mtc2=true; 02014 if(cross==2) { 02015 mode=41; 02016 count=0; 02017 cross=0; 02018 } 02019 break; 02020 case 0: 02021 motor[TIRE_FR].pwm = fast; 02022 motor[TIRE_FR].dir = BACK; 02023 motor[TIRE_FL].pwm = fast; 02024 motor[TIRE_FL].dir = BACK; 02025 motor[TIRE_BR].pwm = fast; 02026 motor[TIRE_BR].dir = FOR; 02027 motor[TIRE_BL].pwm = fast; 02028 motor[TIRE_BL].dir = FOR; 02029 mtc2=true; 02030 break; 02031 case 255: 02032 motor[TIRE_FR].pwm = slow; 02033 motor[TIRE_FR].dir = BACK; 02034 motor[TIRE_FL].pwm = fast; 02035 motor[TIRE_FL].dir = BACK; 02036 motor[TIRE_BR].pwm = fast; 02037 motor[TIRE_BR].dir = FOR; 02038 motor[TIRE_BL].pwm = slow; 02039 motor[TIRE_BL].dir = FOR; 02040 mtc2=true; 02041 break; 02042 case 253: 02043 motor[TIRE_FR].pwm = 0; 02044 motor[TIRE_FR].dir = FREE; 02045 motor[TIRE_FL].pwm = slow; 02046 motor[TIRE_FL].dir = BACK; 02047 motor[TIRE_BR].pwm = slow; 02048 motor[TIRE_BR].dir = FOR; 02049 motor[TIRE_BL].pwm = 0; 02050 motor[TIRE_BL].dir = FREE; 02051 mtc2=true; 02052 break; 02053 case 254: 02054 motor[TIRE_FR].pwm = 0; 02055 motor[TIRE_FR].dir = FREE; 02056 motor[TIRE_FL].pwm = normal; 02057 motor[TIRE_FL].dir = BACK; 02058 motor[TIRE_BR].pwm = normal; 02059 motor[TIRE_BR].dir = FOR; 02060 motor[TIRE_BL].pwm = 0; 02061 motor[TIRE_BL].dir = FREE; 02062 mtc2=true; 02063 break; 02064 case 1: 02065 motor[TIRE_FR].pwm = fast; 02066 motor[TIRE_FR].dir = BACK; 02067 motor[TIRE_FL].pwm = slow; 02068 motor[TIRE_FL].dir = BACK; 02069 motor[TIRE_BR].pwm = slow; 02070 motor[TIRE_BR].dir = FOR; 02071 motor[TIRE_BL].pwm = fast; 02072 motor[TIRE_BL].dir = FOR; 02073 mtc2=true; 02074 break; 02075 case 3: 02076 motor[TIRE_FR].pwm = slow; 02077 motor[TIRE_FR].dir = BACK; 02078 motor[TIRE_FL].pwm = 0; 02079 motor[TIRE_FL].dir = FREE; 02080 motor[TIRE_BR].pwm = 0; 02081 motor[TIRE_BR].dir = FREE; 02082 motor[TIRE_BL].pwm = slow; 02083 motor[TIRE_BL].dir = FOR; 02084 mtc2=true; 02085 break; 02086 case 2: 02087 motor[TIRE_FR].pwm = normal; 02088 motor[TIRE_FR].dir = BACK; 02089 motor[TIRE_FL].pwm = 0; 02090 motor[TIRE_FL].dir = FREE; 02091 motor[TIRE_BR].pwm = 0; 02092 motor[TIRE_BR].dir = FREE; 02093 motor[TIRE_BL].pwm = normal; 02094 motor[TIRE_BL].dir = FOR; 02095 mtc2=true; 02096 break; 02097 } 02098 if(g[2]!=98&&mtc2==true) { 02099 switch(g[2]) { 02100 case 0: 02101 mtc2=false; 02102 break; 02103 case 255: 02104 motor[TIRE_FR].pwm += 5; 02105 mtc2=false; 02106 break; 02107 case 253: 02108 motor[TIRE_FR].pwm += 10; 02109 mtc2=false; 02110 break; 02111 case 254: 02112 motor[TIRE_FR].pwm += 20; 02113 motor[TIRE_BR].pwm = 0; 02114 mtc2=false; 02115 break; 02116 case 1: 02117 motor[TIRE_BR].pwm += 5; 02118 mtc2=false; 02119 break; 02120 case 3: 02121 motor[TIRE_BR].pwm += 10; 02122 mtc2=false; 02123 break; 02124 case 2: 02125 motor[TIRE_BR].pwm += 20; 02126 motor[TIRE_FR].pwm = 0; 02127 mtc2=false; 02128 break; 02129 } 02130 } 02131 } else if(mode==41) { 02132 motor[TIRE_FR].pwm = 30; 02133 motor[TIRE_FR].dir = BACK; 02134 motor[TIRE_FL].pwm = 0; 02135 motor[TIRE_FL].dir = FREE; 02136 motor[TIRE_BR].pwm = 0; 02137 motor[TIRE_BR].dir = FREE; 02138 motor[TIRE_BL].pwm = 30; 02139 motor[TIRE_BL].dir = FOR; 02140 if(g[1]==0) { 02141 count=0; 02142 mode=70; 02143 normal=60; 02144 fast=80; 02145 slow=40; 02146 } 02147 } else if(mode==70) 02148 switch(g[0]) { 02149 case 99: 02150 if(count>=100000) { 02151 cross++; 02152 mode=100; 02153 count=0; 02154 } 02155 if(cross==3) { 02156 cross=0; 02157 mode=100; 02158 } 02159 break; 02160 case 98: 02161 motor[TIRE_FR].pwm = normal; 02162 motor[TIRE_FR].dir = BACK; 02163 motor[TIRE_FL].pwm = normal; 02164 motor[TIRE_FL].dir = FOR; 02165 motor[TIRE_BR].pwm = normal; 02166 motor[TIRE_BR].dir = BACK; 02167 motor[TIRE_BL].pwm = normal; 02168 motor[TIRE_BL].dir = FOR; 02169 break; 02170 case 0: 02171 motor[TIRE_FR].pwm = fast; 02172 motor[TIRE_FR].dir = BACK; 02173 motor[TIRE_FL].pwm = fast; 02174 motor[TIRE_FL].dir = FOR; 02175 motor[TIRE_BR].pwm = fast; 02176 motor[TIRE_BR].dir = BACK; 02177 motor[TIRE_BL].pwm = fast; 02178 motor[TIRE_BL].dir = FOR; 02179 mtc=true; 02180 break; 02181 case 255: 02182 motor[TIRE_FR].pwm = fast; 02183 motor[TIRE_FR].dir = BACK; 02184 motor[TIRE_FL].pwm = slow; 02185 motor[TIRE_FL].dir = FOR; 02186 motor[TIRE_BR].pwm = slow; 02187 motor[TIRE_BR].dir = BACK; 02188 motor[TIRE_BL].pwm = fast; 02189 motor[TIRE_BL].dir = FOR; 02190 mtc=true; 02191 break; 02192 case 253: 02193 motor[TIRE_FR].pwm = slow; 02194 motor[TIRE_FR].dir = BACK; 02195 motor[TIRE_FL].pwm = 0; 02196 motor[TIRE_FL].dir = FREE; 02197 motor[TIRE_BR].pwm = 0; 02198 motor[TIRE_BR].dir = FREE; 02199 motor[TIRE_BL].pwm = slow; 02200 motor[TIRE_BL].dir = FOR; 02201 mtc=true; 02202 break; 02203 case 254: 02204 motor[TIRE_FR].pwm = normal; 02205 motor[TIRE_FR].dir = BACK; 02206 motor[TIRE_FL].pwm = 0; 02207 motor[TIRE_FL].dir = FREE; 02208 motor[TIRE_BR].pwm = 0; 02209 motor[TIRE_BR].dir = FREE; 02210 motor[TIRE_BL].pwm = normal; 02211 motor[TIRE_BL].dir = FOR; 02212 mtc=true; 02213 break; 02214 case 1: 02215 motor[TIRE_FR].pwm = slow; 02216 motor[TIRE_FR].dir = BACK; 02217 motor[TIRE_FL].pwm = fast; 02218 motor[TIRE_FL].dir = FOR; 02219 motor[TIRE_BR].pwm = fast; 02220 motor[TIRE_BR].dir = BACK; 02221 motor[TIRE_BL].pwm = slow; 02222 motor[TIRE_BL].dir = FOR; 02223 mtc=true; 02224 break; 02225 case 3: 02226 motor[TIRE_FR].pwm = 0; 02227 motor[TIRE_FR].dir = FREE; 02228 motor[TIRE_FL].pwm = slow; 02229 motor[TIRE_FL].dir = FOR; 02230 motor[TIRE_BR].pwm = slow; 02231 motor[TIRE_BR].dir = BACK; 02232 motor[TIRE_BL].pwm = 0; 02233 motor[TIRE_BL].dir = FREE; 02234 mtc=true; 02235 break; 02236 case 2: 02237 motor[TIRE_FR].pwm = 0; 02238 motor[TIRE_FR].dir = FREE; 02239 motor[TIRE_FL].pwm = normal; 02240 motor[TIRE_FL].dir = FOR; 02241 motor[TIRE_BR].pwm = normal; 02242 motor[TIRE_BR].dir = BACK; 02243 motor[TIRE_BL].pwm = 0; 02244 motor[TIRE_BL].dir = FREE; 02245 mtc=true; 02246 break; 02247 } 02248 if(g[1]!=98&&mtc==true) { 02249 switch(g[1]) { 02250 case 0: 02251 mtc=false; 02252 break; 02253 case 255: 02254 motor[TIRE_BR].pwm += 5; 02255 mtc=false; 02256 break; 02257 case 253: 02258 motor[TIRE_BR].pwm += 10; 02259 mtc=false; 02260 break; 02261 case 254: 02262 motor[TIRE_BR].pwm += 20; 02263 motor[TIRE_BL].pwm = 0; 02264 mtc=false; 02265 break; 02266 case 1: 02267 motor[TIRE_BL].pwm += 5; 02268 mtc=false; 02269 break; 02270 case 3: 02271 motor[TIRE_BL].pwm += 10; 02272 mtc=false; 02273 break; 02274 case 2: 02275 motor[TIRE_BL].pwm += 20; 02276 motor[TIRE_BR].pwm = 0; 02277 mtc=false; 02278 break; 02279 } 02280 } else if(mode==100) { 02281 motor[TIRE_FR].pwm = 20; 02282 motor[TIRE_FR].dir = BACK; 02283 motor[TIRE_FL].pwm = 20; 02284 motor[TIRE_FL].dir = FOR; 02285 motor[TIRE_BR].pwm = 23; 02286 motor[TIRE_BR].dir = BACK; 02287 motor[TIRE_BL].pwm = 20; 02288 motor[TIRE_BL].dir = FOR; 02289 if(StertSW) { 02290 SW_flag = true; 02291 } 02292 if(SW_flag ==true) { 02293 motor[TIRE_FR].pwm = 100; 02294 motor[TIRE_FR].dir = BRAKE; 02295 motor[TIRE_FL].pwm = 100; 02296 motor[TIRE_FL].dir = BRAKE; 02297 motor[TIRE_BR].pwm = 100; 02298 motor[TIRE_BR].dir = BRAKE; 02299 motor[TIRE_BL].pwm = 100; 02300 motor[TIRE_BL].dir = BRAKE; 02301 fast=60; 02302 normal=40; 02303 slow=20; 02304 mode =1; 02305 cross=0;//十字数える用 02306 cros=0; 02307 count=100000;//wait代替え 02308 UP_flag = false; 02309 SW_flag = false; 02310 Air_flag = false; 02311 zyouge=false; 02312 zyougedo=false; 02313 dz1=true; 02314 dz1i=false; 02315 dz2=true; 02316 dz2i=false; 02317 dz3=true; 02318 dz3i=false; 02319 dz4=true; 02320 dz4i=false; 02321 through=false; 02322 counts=false; 02323 mtc=false; 02324 mtc2 = false; 02325 current = 0; 02326 if(StertSW==false) { 02327 SW_flag = false; 02328 } 02329 } 02330 } 02331 02332 02333 } 02334 #endif 02335 02336 #if USE_PROCESS_NUM>5 02337 static void Process5() 02338 { 02339 LedMode(5); 02340 count++; 02341 if(mode==1) {//スタートゾーンから白線検知 02342 fast=40; 02343 normal=30; 02344 slow=20; 02345 motor[TIRE_FR].pwm = 40; 02346 motor[TIRE_FR].dir = FOR; 02347 motor[TIRE_FL].pwm = 40; 02348 motor[TIRE_FL].dir = BACK; 02349 motor[TIRE_BR].pwm = 40; 02350 motor[TIRE_BR].dir = FOR; 02351 motor[TIRE_BL].pwm = 40; 02352 motor[TIRE_BL].dir = BACK; 02353 if(g[2]==0) { 02354 count=100000; 02355 cross=0; 02356 mode=3; 02357 } 02358 } else if(mode==3) { //横ライントレースから縦ライントレースへ 02359 motor[TIRE_FR].pwm = 25; 02360 motor[TIRE_FR].dir = FOR; 02361 motor[TIRE_FL].pwm = 0; 02362 motor[TIRE_FL].dir = FREE; 02363 motor[TIRE_BR].pwm = 0; 02364 motor[TIRE_BR].dir = FREE; 02365 motor[TIRE_BL].pwm = 25; 02366 motor[TIRE_BL].dir = BACK; 02367 if(g[0]==0) { 02368 mode=10; 02369 count=100000; 02370 } 02371 } else if(mode==10) { //縦ライントレース 02372 02373 if(counts==false&&g[2]==0) { 02374 cros++; 02375 counts=true; 02376 } 02377 if(counts==true&&g[2]==99) { 02378 counts=false; 02379 } 02380 02381 if(cros==Twsh) { 02382 mode=11; 02383 count=0; 02384 cros=0; 02385 }//ゆっくりモードに入れなかった時の保険 02386 switch(g[1]) { 02387 case 98: 02388 motor[TIRE_FR].pwm = normal; 02389 motor[TIRE_FR].dir = FOR; 02390 motor[TIRE_FL].pwm = normal; 02391 motor[TIRE_FL].dir = BACK; 02392 motor[TIRE_BR].pwm = normal; 02393 motor[TIRE_BR].dir = FOR; 02394 motor[TIRE_BL].pwm = normal; 02395 motor[TIRE_BL].dir = BACK; 02396 mtc=true; 02397 if(count>80000) { 02398 cross++; 02399 count=0; 02400 } 02401 if(cross==Twsh) { 02402 mode=11; 02403 count=0; 02404 cross=0; 02405 } 02406 break; 02407 case 0: 02408 motor[TIRE_FR].pwm = fast; 02409 motor[TIRE_FR].dir = FOR; 02410 motor[TIRE_FL].pwm = fast; 02411 motor[TIRE_FL].dir = BACK; 02412 motor[TIRE_BR].pwm = fast; 02413 motor[TIRE_BR].dir = FOR; 02414 motor[TIRE_BL].pwm = fast; 02415 motor[TIRE_BL].dir = BACK; 02416 mtc=true; 02417 break; 02418 case 255: 02419 motor[TIRE_FR].pwm = fast; 02420 motor[TIRE_FR].dir = FOR; 02421 motor[TIRE_FL].pwm = slow; 02422 motor[TIRE_FL].dir = BACK; 02423 motor[TIRE_BR].pwm = slow; 02424 motor[TIRE_BR].dir = FOR; 02425 motor[TIRE_BL].pwm = fast; 02426 motor[TIRE_BL].dir = BACK; 02427 mtc=true; 02428 break; 02429 case 253: 02430 motor[TIRE_FR].pwm = slow; 02431 motor[TIRE_FR].dir = FOR; 02432 motor[TIRE_FL].pwm = 0; 02433 motor[TIRE_FL].dir = FREE; 02434 motor[TIRE_BR].pwm = 0; 02435 motor[TIRE_BR].dir = FREE; 02436 motor[TIRE_BL].pwm = slow; 02437 motor[TIRE_BL].dir = BACK; 02438 mtc=true; 02439 break; 02440 case 254: 02441 motor[TIRE_FR].pwm = normal; 02442 motor[TIRE_FR].dir = FOR; 02443 motor[TIRE_FL].pwm = 0; 02444 motor[TIRE_FL].dir = FREE; 02445 motor[TIRE_BR].pwm = 0; 02446 motor[TIRE_BR].dir = FREE; 02447 motor[TIRE_BL].pwm = normal; 02448 motor[TIRE_BL].dir = BACK; 02449 mtc=true; 02450 break; 02451 case 1: 02452 motor[TIRE_FR].pwm = slow; 02453 motor[TIRE_FR].dir = FOR; 02454 motor[TIRE_FL].pwm = fast; 02455 motor[TIRE_FL].dir = BACK; 02456 motor[TIRE_BR].pwm = fast; 02457 motor[TIRE_BR].dir = FOR; 02458 motor[TIRE_BL].pwm = slow; 02459 motor[TIRE_BL].dir = BACK; 02460 mtc=true; 02461 break; 02462 case 3: 02463 motor[TIRE_FR].pwm = 0; 02464 motor[TIRE_FR].dir = FREE; 02465 motor[TIRE_FL].pwm = slow; 02466 motor[TIRE_FL].dir = BACK; 02467 motor[TIRE_BR].pwm = slow; 02468 motor[TIRE_BR].dir = FOR; 02469 motor[TIRE_BL].pwm = 0; 02470 motor[TIRE_BL].dir = FREE; 02471 mtc=true; 02472 break; 02473 case 2: 02474 motor[TIRE_FR].pwm = 0; 02475 motor[TIRE_FR].dir = FREE; 02476 motor[TIRE_FL].pwm = normal; 02477 motor[TIRE_FL].dir = BACK; 02478 motor[TIRE_BR].pwm = normal; 02479 motor[TIRE_BR].dir = FOR; 02480 motor[TIRE_BL].pwm = 0; 02481 motor[TIRE_BL].dir = FREE; 02482 mtc=true; 02483 break; 02484 } 02485 if(g[0]!=98&&mtc==true) { 02486 switch(g[0]) { 02487 case 0: 02488 mtc=false; 02489 break; 02490 case 255: 02491 motor[TIRE_FL].pwm += 5; 02492 mtc=false; 02493 break; 02494 case 253: 02495 motor[TIRE_FL].pwm += 10; 02496 mtc=false; 02497 break; 02498 case 254: 02499 motor[TIRE_FL].pwm += 20; 02500 motor[TIRE_FR].pwm = 0; 02501 mtc=false; 02502 break; 02503 case 1: 02504 motor[TIRE_FR].pwm += 5; 02505 mtc=false; 02506 break; 02507 case 3: 02508 motor[TIRE_FR].pwm += 10; 02509 mtc=false; 02510 break; 02511 case 2: 02512 motor[TIRE_FR].pwm += 20; 02513 motor[TIRE_FL].pwm = 0; 02514 mtc=false; 02515 break; 02516 } 02517 } 02518 } else if(mode==11) { 02519 motor[TIRE_FR].pwm = normal; 02520 motor[TIRE_FR].dir = FOR; 02521 motor[TIRE_FL].pwm = 0; 02522 motor[TIRE_FL].dir = FREE; 02523 motor[TIRE_BR].pwm = 0; 02524 motor[TIRE_BR].dir = FREE; 02525 motor[TIRE_BL].pwm = normal; 02526 motor[TIRE_BL].dir = BACK; 02527 if(g[2]==0) { 02528 count=0; 02529 cross=0; 02530 mode=20; 02531 fast=40; 02532 normal=30; 02533 slow=20; 02534 } 02535 } else if(mode==20) { 02536 02537 if(Twsh==2) { 02538 solenoid.solenoid2 = SOLENOID_ON; 02539 } 02540 02541 if(counts==false&&g[1]==0) { 02542 cros++; 02543 counts=true; 02544 } 02545 if(counts==true&&g[1]==99) { 02546 counts=false; 02547 } 02548 02549 if(cros==2) { 02550 //mode=21; 02551 //count=0; 02552 //cros=0; 02553 }//ゆっくりモードに入れなかった時の保険 02554 02555 switch(g[2]) { 02556 case 98: 02557 motor[TIRE_FR].pwm = normal; 02558 motor[TIRE_FR].dir = FOR; 02559 motor[TIRE_FL].pwm = normal; 02560 motor[TIRE_FL].dir = FOR; 02561 motor[TIRE_BR].pwm = normal; 02562 motor[TIRE_BR].dir = BACK; 02563 motor[TIRE_BL].pwm = normal; 02564 motor[TIRE_BL].dir = BACK; 02565 if(count>80000) { 02566 cross++; 02567 count=0; 02568 } 02569 mtc2=true; 02570 if(cross==1) { 02571 fast=30; 02572 normal=20; 02573 slow=20; 02574 } 02575 if(cross==2) { 02576 mode=21; 02577 cross=0; 02578 } 02579 break; 02580 case 0: 02581 motor[TIRE_FR].pwm = fast; 02582 motor[TIRE_FR].dir = FOR; 02583 motor[TIRE_FL].pwm = fast; 02584 motor[TIRE_FL].dir = FOR; 02585 motor[TIRE_BR].pwm = fast; 02586 motor[TIRE_BR].dir = BACK; 02587 motor[TIRE_BL].pwm = fast; 02588 motor[TIRE_BL].dir = BACK; 02589 mtc2=true; 02590 break; 02591 case 255: 02592 motor[TIRE_FR].pwm = normal; 02593 motor[TIRE_FR].dir = FOR; 02594 motor[TIRE_FL].pwm = fast; 02595 motor[TIRE_FL].dir = FOR; 02596 motor[TIRE_BR].pwm = fast; 02597 motor[TIRE_BR].dir = BACK; 02598 motor[TIRE_BL].pwm = normal; 02599 motor[TIRE_BL].dir = BACK; 02600 mtc2=true; 02601 break; 02602 case 253: 02603 motor[TIRE_FR].pwm = 0; 02604 motor[TIRE_FR].dir = FREE; 02605 motor[TIRE_FL].pwm = slow; 02606 motor[TIRE_FL].dir = FOR; 02607 motor[TIRE_BR].pwm = slow; 02608 motor[TIRE_BR].dir = BACK; 02609 motor[TIRE_BL].pwm = 0; 02610 motor[TIRE_BL].dir = FREE; 02611 mtc2=true; 02612 break; 02613 case 254: 02614 motor[TIRE_FR].pwm = 0; 02615 motor[TIRE_FR].dir = FREE; 02616 motor[TIRE_FL].pwm = normal; 02617 motor[TIRE_FL].dir = FOR; 02618 motor[TIRE_BR].pwm = normal; 02619 motor[TIRE_BR].dir = BACK; 02620 motor[TIRE_BL].pwm = 0; 02621 motor[TIRE_BL].dir = FREE; 02622 mtc2=true; 02623 break; 02624 case 1: 02625 motor[TIRE_FR].pwm = fast; 02626 motor[TIRE_FR].dir = FOR; 02627 motor[TIRE_FL].pwm = slow; 02628 motor[TIRE_FL].dir = FOR; 02629 motor[TIRE_BR].pwm = slow; 02630 motor[TIRE_BR].dir = BACK; 02631 motor[TIRE_BL].pwm = fast; 02632 motor[TIRE_BL].dir = BACK; 02633 mtc2=true; 02634 break; 02635 case 3: 02636 motor[TIRE_FR].pwm = slow; 02637 motor[TIRE_FR].dir = FOR; 02638 motor[TIRE_FL].pwm = 0; 02639 motor[TIRE_FL].dir = FREE; 02640 motor[TIRE_BR].pwm = 0; 02641 motor[TIRE_BR].dir = FREE; 02642 motor[TIRE_BL].pwm = slow; 02643 motor[TIRE_BL].dir = BACK; 02644 mtc2=true; 02645 break; 02646 case 2: 02647 motor[TIRE_FR].pwm = normal; 02648 motor[TIRE_FR].dir = FOR; 02649 motor[TIRE_FL].pwm = 0; 02650 motor[TIRE_FL].dir = FREE; 02651 motor[TIRE_BR].pwm = 0; 02652 motor[TIRE_BR].dir = FREE; 02653 motor[TIRE_BL].pwm = normal; 02654 motor[TIRE_BL].dir = BACK; 02655 mtc2=true; 02656 break; 02657 } 02658 if(g[2]!=98&&mtc2==true) { 02659 switch(g[3]) { 02660 case 0: 02661 mtc2=false; 02662 break; 02663 case 255: 02664 motor[TIRE_BL].pwm += 5; 02665 mtc2=false; 02666 break; 02667 case 253: 02668 motor[TIRE_BL].pwm += 10; 02669 mtc2=false; 02670 break; 02671 case 254: 02672 motor[TIRE_BL].pwm += 20; 02673 motor[TIRE_FL].pwm = 0; 02674 mtc2=false; 02675 break; 02676 case 1: 02677 motor[TIRE_FL].pwm += 5; 02678 mtc2=false; 02679 break; 02680 case 3: 02681 motor[TIRE_FL].pwm += 10; 02682 mtc2=false; 02683 break; 02684 case 2: 02685 motor[TIRE_FL].pwm += 20; 02686 motor[TIRE_BL].pwm = 0; 02687 mtc2=false; 02688 break; 02689 } 02690 } 02691 } else if(mode==21) { 02692 motor[TIRE_FR].pwm = 20; 02693 motor[TIRE_FR].dir = BACK; 02694 motor[TIRE_FL].pwm = 20; 02695 motor[TIRE_FL].dir = BACK; 02696 motor[TIRE_BR].pwm = 20; 02697 motor[TIRE_BR].dir = FOR; 02698 motor[TIRE_BL].pwm = 20; 02699 motor[TIRE_BL].dir = FOR; 02700 if(g[2]!=98) { 02701 mode=30; 02702 } 02703 02704 } else if(mode==30) { 02705 motor[TIRE_FR].pwm = 60; 02706 motor[TIRE_FR].dir = FOR; 02707 motor[TIRE_FL].pwm = 60; 02708 motor[TIRE_FL].dir = BACK; 02709 motor[TIRE_BR].pwm = 60; 02710 motor[TIRE_BR].dir = FOR; 02711 motor[TIRE_BL].pwm = 60; 02712 motor[TIRE_BL].dir = BACK; 02713 if(g[1]==98) { 02714 mode=31; 02715 } 02716 //ゆっくりモードに入れなかった時の保険 02717 /* 02718 switch(g[1]) { 02719 case 98: 02720 motor[TIRE_FR].pwm = 30; 02721 motor[TIRE_FR].dir = FOR; 02722 motor[TIRE_FL].pwm = 30; 02723 motor[TIRE_FL].dir = BACK; 02724 motor[TIRE_BR].pwm = 30; 02725 motor[TIRE_BR].dir = FOR; 02726 motor[TIRE_BL].pwm = 30; 02727 motor[TIRE_BL].dir = BACK; 02728 if(count>100000) { 02729 cross++; 02730 count=0; 02731 } 02732 mtc=true; 02733 if(cross==1) { 02734 if(Twsh==2) { 02735 solenoid.solenoid2 = SOLENOID_OFF; 02736 } 02737 mode=31; 02738 count=0; 02739 } 02740 break; 02741 case 0: 02742 motor[TIRE_FR].pwm = 60; 02743 motor[TIRE_FR].dir = FOR; 02744 motor[TIRE_FL].pwm = 60; 02745 motor[TIRE_FL].dir = BACK; 02746 motor[TIRE_BR].pwm = 60; 02747 motor[TIRE_BR].dir = FOR; 02748 motor[TIRE_BL].pwm = 60; 02749 motor[TIRE_BL].dir = BACK; 02750 mtc=true; 02751 break; 02752 case 255: 02753 motor[TIRE_FR].pwm = 60; 02754 motor[TIRE_FR].dir = FOR; 02755 motor[TIRE_FL].pwm = 20; 02756 motor[TIRE_FL].dir = BACK; 02757 motor[TIRE_BR].pwm = 20; 02758 motor[TIRE_BR].dir = FOR; 02759 motor[TIRE_BL].pwm = 60; 02760 motor[TIRE_BL].dir = BACK; 02761 mtc=true; 02762 break; 02763 case 253: 02764 motor[TIRE_FR].pwm = 20; 02765 motor[TIRE_FR].dir = FOR; 02766 motor[TIRE_FL].pwm = 0; 02767 motor[TIRE_FL].dir = BACK; 02768 motor[TIRE_BR].pwm = 0; 02769 motor[TIRE_BR].dir = FOR; 02770 motor[TIRE_BL].pwm = 20; 02771 motor[TIRE_BL].dir = BACK; 02772 mtc=true; 02773 break; 02774 case 254: 02775 motor[TIRE_FR].pwm = 30; 02776 motor[TIRE_FR].dir = FOR; 02777 motor[TIRE_FL].pwm = 0; 02778 motor[TIRE_FL].dir = FREE; 02779 motor[TIRE_BR].pwm = 0; 02780 motor[TIRE_BR].dir = FREE; 02781 motor[TIRE_BL].pwm = 30; 02782 motor[TIRE_BL].dir = BACK; 02783 mtc=true; 02784 break; 02785 case 1: 02786 motor[TIRE_FR].pwm = 20; 02787 motor[TIRE_FR].dir = FOR; 02788 motor[TIRE_FL].pwm = 60; 02789 motor[TIRE_FL].dir = BACK; 02790 motor[TIRE_BR].pwm = 60; 02791 motor[TIRE_BR].dir = FOR; 02792 motor[TIRE_BL].pwm = 20; 02793 motor[TIRE_BL].dir = BACK; 02794 mtc=true; 02795 break; 02796 case 3: 02797 motor[TIRE_FR].pwm = 0; 02798 motor[TIRE_FR].dir = FREE; 02799 motor[TIRE_FL].pwm = 20; 02800 motor[TIRE_FL].dir = BACK; 02801 motor[TIRE_BR].pwm = 20; 02802 motor[TIRE_BR].dir = FOR; 02803 motor[TIRE_BL].pwm = 0; 02804 motor[TIRE_BL].dir = FREE; 02805 mtc=true; 02806 break; 02807 case 2: 02808 motor[TIRE_FR].pwm = 0; 02809 motor[TIRE_FR].dir = FREE; 02810 motor[TIRE_FL].pwm = 30; 02811 motor[TIRE_FL].dir = BACK; 02812 motor[TIRE_BR].pwm = 30; 02813 motor[TIRE_BR].dir = FOR; 02814 motor[TIRE_BL].pwm = 0; 02815 motor[TIRE_BL].dir = FREE; 02816 mtc=true; 02817 break; 02818 } 02819 if(g[1]!=98&&mtc==true) { 02820 switch(g[0]) { 02821 case 0: 02822 mtc=false; 02823 break; 02824 case 255: 02825 motor[TIRE_FL].pwm += 5; 02826 mtc=false; 02827 break; 02828 case 253: 02829 motor[TIRE_FL].pwm += 10; 02830 mtc=false; 02831 break; 02832 case 254: 02833 motor[TIRE_FL].pwm += 20; 02834 motor[TIRE_FR].pwm = 0; 02835 mtc=false; 02836 break; 02837 case 1: 02838 motor[TIRE_FR].pwm += 5; 02839 mtc=false; 02840 break; 02841 case 3: 02842 motor[TIRE_FR].pwm += 10; 02843 mtc=false; 02844 break; 02845 case 2: 02846 motor[TIRE_FR].pwm += 20; 02847 motor[TIRE_FL].pwm = 0; 02848 mtc=false; 02849 break; 02850 } 02851 02852 } 02853 */ 02854 } else if(mode==31) { 02855 motor[TIRE_FR].pwm = 15; 02856 motor[TIRE_FR].dir = FOR; 02857 motor[TIRE_FL].pwm = 15; 02858 motor[TIRE_FL].dir = BACK; 02859 motor[TIRE_BR].pwm = 15; 02860 motor[TIRE_BR].dir = FOR; 02861 motor[TIRE_BL].pwm = 15; 02862 motor[TIRE_BL].dir = BACK; 02863 if(g[3]==0) { 02864 count=0; 02865 mode=32; 02866 } 02867 } else if(mode==32) { 02868 motor[TIRE_FR].pwm = 30; 02869 motor[TIRE_FR].dir = BACK; 02870 motor[TIRE_FL].pwm = 30; 02871 motor[TIRE_FL].dir = FOR; 02872 motor[TIRE_BR].pwm = 30; 02873 motor[TIRE_BR].dir = BACK; 02874 motor[TIRE_BL].pwm = 30; 02875 motor[TIRE_BL].dir = FOR; 02876 if(g[3]==0) { 02877 count=0; 02878 if(Twsh==2) { 02879 solenoid.solenoid2 = SOLENOID_OFF; 02880 } 02881 mode=40; 02882 } 02883 } else if(mode==40) { 02884 02885 if(LIF) { 02886 mode=42; 02887 } 02888 02889 if(counts==false&&g[0]==0) { 02890 cros++; 02891 counts=true; 02892 } 02893 if(counts==true&&g[0]==99) { 02894 counts=false; 02895 } 02896 02897 if(cros==2) { 02898 // mode=41; 02899 //count=0; 02900 //cros=0; 02901 }//ゆっくりモードに入れなかった時の保険 02902 02903 switch(g[3]) { 02904 case 98: 02905 motor[TIRE_FR].pwm = normal; 02906 motor[TIRE_FR].dir = BACK; 02907 motor[TIRE_FL].pwm = normal; 02908 motor[TIRE_FL].dir = BACK; 02909 motor[TIRE_BR].pwm = normal; 02910 motor[TIRE_BR].dir = FOR; 02911 motor[TIRE_BL].pwm = normal; 02912 motor[TIRE_BL].dir = FOR; 02913 if(count>20000) { 02914 cross++; 02915 count=0; 02916 } 02917 mtc2=true; 02918 if(cross==1) { 02919 mode=41; 02920 count=0; 02921 cross=0; 02922 } 02923 break; 02924 case 0: 02925 motor[TIRE_FR].pwm = fast; 02926 motor[TIRE_FR].dir = BACK; 02927 motor[TIRE_FL].pwm = fast; 02928 motor[TIRE_FL].dir = BACK; 02929 motor[TIRE_BR].pwm = fast; 02930 motor[TIRE_BR].dir = FOR; 02931 motor[TIRE_BL].pwm = fast; 02932 motor[TIRE_BL].dir = FOR; 02933 mtc2=true; 02934 break; 02935 case 255: 02936 motor[TIRE_FR].pwm = slow; 02937 motor[TIRE_FR].dir = BACK; 02938 motor[TIRE_FL].pwm = fast; 02939 motor[TIRE_FL].dir = BACK; 02940 motor[TIRE_BR].pwm = fast; 02941 motor[TIRE_BR].dir = FOR; 02942 motor[TIRE_BL].pwm = slow; 02943 motor[TIRE_BL].dir = FOR; 02944 mtc2=true; 02945 break; 02946 case 253: 02947 motor[TIRE_FR].pwm = 0; 02948 motor[TIRE_FR].dir = FREE; 02949 motor[TIRE_FL].pwm = slow; 02950 motor[TIRE_FL].dir = BACK; 02951 motor[TIRE_BR].pwm = slow; 02952 motor[TIRE_BR].dir = FOR; 02953 motor[TIRE_BL].pwm = 0; 02954 motor[TIRE_BL].dir = FREE; 02955 mtc2=true; 02956 break; 02957 case 254: 02958 motor[TIRE_FR].pwm = 0; 02959 motor[TIRE_FR].dir = FREE; 02960 motor[TIRE_FL].pwm = normal; 02961 motor[TIRE_FL].dir = BACK; 02962 motor[TIRE_BR].pwm = normal; 02963 motor[TIRE_BR].dir = FOR; 02964 motor[TIRE_BL].pwm = 0; 02965 motor[TIRE_BL].dir = FREE; 02966 mtc2=true; 02967 break; 02968 case 1: 02969 motor[TIRE_FR].pwm = fast; 02970 motor[TIRE_FR].dir = BACK; 02971 motor[TIRE_FL].pwm = slow; 02972 motor[TIRE_FL].dir = BACK; 02973 motor[TIRE_BR].pwm = slow; 02974 motor[TIRE_BR].dir = FOR; 02975 motor[TIRE_BL].pwm = fast; 02976 motor[TIRE_BL].dir = FOR; 02977 mtc2=true; 02978 break; 02979 case 3: 02980 motor[TIRE_FR].pwm = slow; 02981 motor[TIRE_FR].dir = BACK; 02982 motor[TIRE_FL].pwm = 0; 02983 motor[TIRE_FL].dir = FREE; 02984 motor[TIRE_BR].pwm = 0; 02985 motor[TIRE_BR].dir = FREE; 02986 motor[TIRE_BL].pwm = slow; 02987 motor[TIRE_BL].dir = FOR; 02988 mtc2=true; 02989 break; 02990 case 2: 02991 motor[TIRE_FR].pwm = normal; 02992 motor[TIRE_FR].dir = BACK; 02993 motor[TIRE_FL].pwm = 0; 02994 motor[TIRE_FL].dir = FREE; 02995 motor[TIRE_BR].pwm = 0; 02996 motor[TIRE_BR].dir = FREE; 02997 motor[TIRE_BL].pwm = normal; 02998 motor[TIRE_BL].dir = FOR; 02999 mtc2=true; 03000 break; 03001 } 03002 if(g[2]!=98&&mtc2==true) { 03003 switch(g[2]) { 03004 case 0: 03005 mtc2=false; 03006 break; 03007 case 255: 03008 motor[TIRE_FR].pwm += 5; 03009 mtc2=false; 03010 break; 03011 case 253: 03012 motor[TIRE_FR].pwm += 10; 03013 mtc2=false; 03014 break; 03015 case 254: 03016 motor[TIRE_FR].pwm += 20; 03017 motor[TIRE_BR].pwm = 0; 03018 mtc2=false; 03019 break; 03020 case 1: 03021 motor[TIRE_BR].pwm += 5; 03022 mtc2=false; 03023 break; 03024 case 3: 03025 motor[TIRE_BR].pwm += 10; 03026 mtc2=false; 03027 break; 03028 case 2: 03029 motor[TIRE_BR].pwm += 20; 03030 motor[TIRE_FR].pwm = 0; 03031 mtc2=false; 03032 break; 03033 } 03034 } 03035 } else if(mode==41) { 03036 motor[TIRE_FR].pwm = 30; 03037 motor[TIRE_FR].dir = BACK; 03038 motor[TIRE_FL].pwm = 0; 03039 motor[TIRE_FL].dir = FREE; 03040 motor[TIRE_BR].pwm = 0; 03041 motor[TIRE_BR].dir = FREE; 03042 motor[TIRE_BL].pwm = 30; 03043 motor[TIRE_BL].dir = FOR; 03044 if(g[1]==0) { 03045 count=0; 03046 mode=70; 03047 normal=60; 03048 fast=80; 03049 slow=40; 03050 } 03051 } else if(mode==42) { 03052 motor[TIRE_FR].pwm = 30; 03053 motor[TIRE_FR].dir = FOR; 03054 motor[TIRE_FL].pwm = 30; 03055 motor[TIRE_FL].dir = FOR; 03056 motor[TIRE_BR].pwm = 30; 03057 motor[TIRE_BR].dir = BACK; 03058 motor[TIRE_BL].pwm = 30; 03059 motor[TIRE_BL].dir = BACK; 03060 if(g[1]==0) { 03061 count=0; 03062 mode=70; 03063 normal=60; 03064 fast=80; 03065 slow=40; 03066 } 03067 03068 } else if(mode==70) 03069 switch(g[0]) { 03070 case 99: 03071 if(count>=100000) { 03072 cross++; 03073 mode=100; 03074 count=0; 03075 } 03076 if(cross==3) { 03077 cross=0; 03078 mode=100; 03079 } 03080 break; 03081 case 98: 03082 motor[TIRE_FR].pwm = normal; 03083 motor[TIRE_FR].dir = BACK; 03084 motor[TIRE_FL].pwm = normal; 03085 motor[TIRE_FL].dir = FOR; 03086 motor[TIRE_BR].pwm = normal; 03087 motor[TIRE_BR].dir = BACK; 03088 motor[TIRE_BL].pwm = normal; 03089 motor[TIRE_BL].dir = FOR; 03090 break; 03091 case 0: 03092 motor[TIRE_FR].pwm = fast; 03093 motor[TIRE_FR].dir = BACK; 03094 motor[TIRE_FL].pwm = fast; 03095 motor[TIRE_FL].dir = FOR; 03096 motor[TIRE_BR].pwm = fast; 03097 motor[TIRE_BR].dir = BACK; 03098 motor[TIRE_BL].pwm = fast; 03099 motor[TIRE_BL].dir = FOR; 03100 mtc=true; 03101 break; 03102 case 255: 03103 motor[TIRE_FR].pwm = fast; 03104 motor[TIRE_FR].dir = BACK; 03105 motor[TIRE_FL].pwm = slow; 03106 motor[TIRE_FL].dir = FOR; 03107 motor[TIRE_BR].pwm = slow; 03108 motor[TIRE_BR].dir = BACK; 03109 motor[TIRE_BL].pwm = fast; 03110 motor[TIRE_BL].dir = FOR; 03111 mtc=true; 03112 break; 03113 case 253: 03114 motor[TIRE_FR].pwm = slow; 03115 motor[TIRE_FR].dir = BACK; 03116 motor[TIRE_FL].pwm = 0; 03117 motor[TIRE_FL].dir = FREE; 03118 motor[TIRE_BR].pwm = 0; 03119 motor[TIRE_BR].dir = FREE; 03120 motor[TIRE_BL].pwm = slow; 03121 motor[TIRE_BL].dir = FOR; 03122 mtc=true; 03123 break; 03124 case 254: 03125 motor[TIRE_FR].pwm = normal; 03126 motor[TIRE_FR].dir = BACK; 03127 motor[TIRE_FL].pwm = 0; 03128 motor[TIRE_FL].dir = FREE; 03129 motor[TIRE_BR].pwm = 0; 03130 motor[TIRE_BR].dir = FREE; 03131 motor[TIRE_BL].pwm = normal; 03132 motor[TIRE_BL].dir = FOR; 03133 mtc=true; 03134 break; 03135 case 1: 03136 motor[TIRE_FR].pwm = slow; 03137 motor[TIRE_FR].dir = BACK; 03138 motor[TIRE_FL].pwm = fast; 03139 motor[TIRE_FL].dir = FOR; 03140 motor[TIRE_BR].pwm = fast; 03141 motor[TIRE_BR].dir = BACK; 03142 motor[TIRE_BL].pwm = slow; 03143 motor[TIRE_BL].dir = FOR; 03144 mtc=true; 03145 break; 03146 case 3: 03147 motor[TIRE_FR].pwm = 0; 03148 motor[TIRE_FR].dir = FREE; 03149 motor[TIRE_FL].pwm = slow; 03150 motor[TIRE_FL].dir = FOR; 03151 motor[TIRE_BR].pwm = slow; 03152 motor[TIRE_BR].dir = BACK; 03153 motor[TIRE_BL].pwm = 0; 03154 motor[TIRE_BL].dir = FREE; 03155 mtc=true; 03156 break; 03157 case 2: 03158 motor[TIRE_FR].pwm = 0; 03159 motor[TIRE_FR].dir = FREE; 03160 motor[TIRE_FL].pwm = normal; 03161 motor[TIRE_FL].dir = FOR; 03162 motor[TIRE_BR].pwm = normal; 03163 motor[TIRE_BR].dir = BACK; 03164 motor[TIRE_BL].pwm = 0; 03165 motor[TIRE_BL].dir = FREE; 03166 mtc=true; 03167 break; 03168 } 03169 if(g[1]!=98&&mtc==true) { 03170 switch(g[1]) { 03171 case 0: 03172 mtc=false; 03173 break; 03174 case 255: 03175 motor[TIRE_BR].pwm += 5; 03176 mtc=false; 03177 break; 03178 case 253: 03179 motor[TIRE_BR].pwm += 10; 03180 mtc=false; 03181 break; 03182 case 254: 03183 motor[TIRE_BR].pwm += 20; 03184 motor[TIRE_BL].pwm = 0; 03185 mtc=false; 03186 break; 03187 case 1: 03188 motor[TIRE_BL].pwm += 5; 03189 mtc=false; 03190 break; 03191 case 3: 03192 motor[TIRE_BL].pwm += 10; 03193 mtc=false; 03194 break; 03195 case 2: 03196 motor[TIRE_BL].pwm += 20; 03197 motor[TIRE_BR].pwm = 0; 03198 mtc=false; 03199 break; 03200 } 03201 } else if(mode==100) { 03202 motor[TIRE_FR].pwm = 20; 03203 motor[TIRE_FR].dir = BACK; 03204 motor[TIRE_FL].pwm = 20; 03205 motor[TIRE_FL].dir = FOR; 03206 motor[TIRE_BR].pwm = 23; 03207 motor[TIRE_BR].dir = BACK; 03208 motor[TIRE_BL].pwm = 20; 03209 motor[TIRE_BL].dir = FOR; 03210 if(StertSW) { 03211 SW_flag = true; 03212 } 03213 if(SW_flag ==true) { 03214 motor[TIRE_FR].pwm = 100; 03215 motor[TIRE_FR].dir = BRAKE; 03216 motor[TIRE_FL].pwm = 100; 03217 motor[TIRE_FL].dir = BRAKE; 03218 motor[TIRE_BR].pwm = 100; 03219 motor[TIRE_BR].dir = BRAKE; 03220 motor[TIRE_BL].pwm = 100; 03221 motor[TIRE_BL].dir = BRAKE; 03222 fast=60; 03223 normal=40; 03224 slow=20; 03225 mode =1; 03226 cross=0;//十字数える用 03227 cros=0; 03228 count=100000;//wait代替え 03229 UP_flag = false; 03230 SW_flag = false; 03231 Air_flag = false; 03232 zyouge=false; 03233 zyougedo=false; 03234 dz1=true; 03235 dz1i=false; 03236 dz2=true; 03237 dz2i=false; 03238 dz3=true; 03239 dz3i=false; 03240 dz4=true; 03241 dz4i=false; 03242 through=false; 03243 counts=false; 03244 mtc=false; 03245 mtc2 = false; 03246 current = 0; 03247 if(StertSW==false) { 03248 SW_flag = false; 03249 } 03250 } 03251 } 03252 03253 03254 03255 } 03256 #endif 03257 03258 #if USE_PROCESS_NUM>6 03259 static void Process6() 03260 { 03261 03262 } 03263 #endif 03264 03265 #if USE_PROCESS_NUM>7 03266 static void Process7() 03267 { 03268 03269 } 03270 #endif 03271 03272 #if USE_PROCESS_NUM>8 03273 static void Process8() 03274 { 03275 03276 } 03277 #endif 03278 03279 #if USE_PROCESS_NUM>9 03280 static void Process9() 03281 { 03282 03283 } 03284 #endif 03285 #endif 03286 #pragma endregion PROCESS 03287 03288 static void AllActuatorReset() 03289 { 03290 03291 #ifdef USE_SOLENOID 03292 solenoid.all = ALL_SOLENOID_OFF; 03293 #endif 03294 03295 #ifdef USE_MOTOR 03296 for (uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) { 03297 motor[i].dir = FREE; 03298 motor[i].pwm = 0; 03299 } 03300 #endif 03301 } 03302 03303 /* 03304 void BuzzerTimer_func() 03305 { 03306 buzzer = !buzzer; 03307 //LED_DEBUG0 = !LED_DEBUG0; 03308 } 03309 */ 03310 void TapeLedEms_func() 03311 { 03312 sendLedData.code = sendLedData.code == (uint32_t)Red ? (uint32_t)Black : (uint32_t)Red; 03313 } 03314 03315 #pragma region USER-DEFINED-FUNCTIONS 03316 03317 03318 #pragma endregion
Generated on Tue Jul 12 2022 14:55:23 by
1.7.2