aaaaa

Dependencies:   mbed Servo

Committer:
niimurasyou
Date:
Thu Feb 21 01:04:40 2019 +0000
Revision:
10:a765515594bd
Parent:
9:ec30ae33cc9e
Child:
11:88f17bc0724f
aaa

Who changed what in which revision?

UserRevisionLine numberNew contents of line
niimurasyou 10:a765515594bd 1
t_yamamoto 8:cb53beff4bb2 2 //2018/02/24のやつ
t_yamamoto 5:a802ab60df1b 3
t_yamamoto 0:562021ed1ba9 4 #include "Process.h"
t_yamamoto 0:562021ed1ba9 5
t_yamamoto 0:562021ed1ba9 6 #include "mbed.h"
t_yamamoto 0:562021ed1ba9 7 #include "../../Communication/XBee/XBee.h"
t_yamamoto 0:562021ed1ba9 8 #include "../../Input/Switch/Switch.h"
t_yamamoto 0:562021ed1ba9 9 #include "../../Output/Motor/Motor.h"
t_yamamoto 8:cb53beff4bb2 10 #include "../../Output/Servo/Servo.h"
t_yamamoto 8:cb53beff4bb2 11
t_yamamoto 0:562021ed1ba9 12 //_____________________
t_yamamoto 0:562021ed1ba9 13 /*---------------- HOW TO WRITE ----------------/
t_yamamoto 0:562021ed1ba9 14
t_yamamoto 0:562021ed1ba9 15 ・motor の割り当てを決める
t_yamamoto 0:562021ed1ba9 16 #define TIRE_L 1
t_yamamoto 0:562021ed1ba9 17
t_yamamoto 0:562021ed1ba9 18 ・リミットスイッチの割り当てを決める
t_yamamoto 0:562021ed1ba9 19 #define ARM_L 1
t_yamamoto 0:562021ed1ba9 20
t_yamamoto 0:562021ed1ba9 21 ・他にも自由に定義してもいいです (pwmとか)
t_yamamoto 0:562021ed1ba9 22
t_yamamoto 0:562021ed1ba9 23 /---------------- HOW TO WRITE ----------------*/
t_yamamoto 0:562021ed1ba9 24 //↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
t_yamamoto 0:562021ed1ba9 25
niimurasyou 9:ec30ae33cc9e 26 #define a 0
niimurasyou 9:ec30ae33cc9e 27 #define b 1
niimurasyou 9:ec30ae33cc9e 28 #define c 2
niimurasyou 9:ec30ae33cc9e 29
niimurasyou 9:ec30ae33cc9e 30
niimurasyou 9:ec30ae33cc9e 31 int a_array[15][15] = {
niimurasyou 10:a765515594bd 32 {-80, -70, -60, -50, -40, -20, -10, 0, 10, 20, 40, 50, 60, 70, 80},
niimurasyou 10:a765515594bd 33 {-79, -69, -55, -47, -35, -20, -10, 0, 10, 20, 35, 47, 55, 69, 79},
niimurasyou 10:a765515594bd 34 {-77, -68, -50, -45, -30, -20, -10, 0, 10, 20, 30, 45, 50, 68, 77},
niimurasyou 10:a765515594bd 35 {-75, -67, -49, -40, -25, -20, -10, 0, 10, 20, 25, 40, 49, 67, 75},
niimurasyou 10:a765515594bd 36 {-73, -66, -48, -37, -20, -20, -10, 0, 10, 20, 20, 37, 48, 66, 73},
niimurasyou 10:a765515594bd 37 {-71, -62, -46, -32, -20, -10, 0 , 0, 0 , 10, 20, 32, 46, 62, 71},
niimurasyou 10:a765515594bd 38 {-70, -60, -45, -30, -20, -10, 0 , 0, 0 , 10, 20, 30, 45, 60, 70},
niimurasyou 10:a765515594bd 39 {-71, -62, -46, -32, 10 , -10, 0 , 0, 0 , 10, 20, 32, 46, 62, 71},
niimurasyou 10:a765515594bd 40 {-72, -64, -47, -35, 20 , -10, -10, 0, 10, 10, 20, 35, 47, 64, 72},
niimurasyou 10:a765515594bd 41 {-73, -66, -48, -37, -20, -20, -10, 0, 10, 20, 20, 37, 48, 66, 73},
niimurasyou 10:a765515594bd 42 {-75, -67, -49, -40, 40 , -20, -10, 0, 10, 20, 25, 40, 49, 67, 75},
niimurasyou 10:a765515594bd 43 {-77, -68, -50, -45, 60 , -20, -10, 0, 10, 20, 30, 45, 50, 68, 77},
niimurasyou 10:a765515594bd 44 {-79, -69, -55, -47, 70 , -20, -10, 0, 10, 20, 35, 47, 55, 69, 79},
niimurasyou 10:a765515594bd 45 {-80, -70, -60, -50, -40, -20, -10, 0, 10, 20, 40, 50, 60, 70, 80}};
niimurasyou 9:ec30ae33cc9e 46
niimurasyou 9:ec30ae33cc9e 47 int b_array[15][15] = {
niimurasyou 10:a765515594bd 48 {80, 80, 80 , 77 , 75 , 72 , 71 , 70, 60, 50, 40, 30, 20, 10, 0},
niimurasyou 10:a765515594bd 49 {80, 80, 75 , 70 , 65 , 60 , 55 , 50, 45, 40, 30, 20, 10, 0 , -10},
niimurasyou 10:a765515594bd 50 {80, 71, 70 , 60 , 55 , 50 , 45 , 40, 35, 30, 20, 10, 0, -10, -13},
niimurasyou 10:a765515594bd 51 {60, 60, 57 , 50 , 45 , 40 , 35 , 30, 25, 20, 10, 0 , -10, -13, -17},
niimurasyou 10:a765515594bd 52 {50, 50, 50 , 40 , 35 , 30 , 23 , 20, 15, 10, 0 , -10, -15, -17, -20},
niimurasyou 10:a765515594bd 53 {45, 45, 43 , 35 , 30 , 25 , 10 , 10, 10, 0 , -10, -15, -20, -20, -25},
niimurasyou 10:a765515594bd 54 {40, 37, 35 , 30 , 25 , 20 , 0 , 0 , 0 , -10, -15, -20, -25, -25, -30},
niimurasyou 10:a765515594bd 55 {35, 30, 30 , 25 , 20 , 15 , 0 , 0 , 0 , -15, -20, -25, -30, -30, -35},
niimurasyou 10:a765515594bd 56 {30, 25, 25 , 20 , 15 , 10 , 0 , 0 , 0 , -20, -25, -30, -35, -37, -40},
niimurasyou 10:a765515594bd 57 {20, 17, 15 , 10 , 0 , -10, -15,-20, -23, -30 ,-35 ,-40 ,-50 ,-50 , -50},
niimurasyou 10:a765515594bd 58 {17, 13, 10 , 0 , -10, -20, -25,-30, -35, -40 ,-45 ,-50 ,-57 ,-60 , -60},
niimurasyou 10:a765515594bd 59 {13, 10, 0 , -10, -20, -30, -35,-40, -45, -50 ,-55 ,-60 , -70, -71, -80},
niimurasyou 10:a765515594bd 60 {10, 0 , -10, -20, -30, -40, -45,-50, -55, -60 ,-65 ,-70 ,-75 ,-80 , -80},
niimurasyou 10:a765515594bd 61 {0 , -10, -20, -30, -40, -50, -60,-70, -71, -72 ,-75 ,-77 ,-80 ,-80 , -80}};
niimurasyou 10:a765515594bd 62
niimurasyou 10:a765515594bd 63 int c_array[15][15] = {
niimurasyou 10:a765515594bd 64 {0, 10, 20 , 30 , 40 , 50 , 60 ,70 , 71, 72 , 75 , 77 , 80 , 80 , 80},
niimurasyou 10:a765515594bd 65 {-10, 0 , 10 , 20 , 30 , 40 , 45 ,50 , 55 , 60 ,65 ,70 ,75 ,80 ,80},
niimurasyou 10:a765515594bd 66 {-13, -10, 0 , 10 , 20 , 30 , 35 ,40 , 45 , 50 ,55 ,60 ,70 ,71 ,80},
niimurasyou 10:a765515594bd 67 {-17, -13, -10, 0 , 10 , 20 , 25 ,30 , 35 , 40 ,45 ,50 ,57 ,60 ,60},
niimurasyou 10:a765515594bd 68 {-20, -17, -15, -10, 0 , 10 , 15 ,20 , 23 , 30 ,35 ,40 ,50 ,50 ,50},
niimurasyou 10:a765515594bd 69 {-25, -20, -20, -15, -10, 0 , 10 ,10 , 10 , 25 ,30 ,35 ,43 ,45 ,45},
niimurasyou 10:a765515594bd 70 {-30, -25, -25, -20, -15, -10, 0 ,0 , 0 , 20 ,25 ,30 ,35 ,37 ,40},
niimurasyou 10:a765515594bd 71 {-35, -30, -30, -25, -20, -15, 0 ,0 , 0 , 15 ,20 ,25 ,30 ,30 ,35},
niimurasyou 10:a765515594bd 72 {-40, -37, -35, -30, -25, -20, 0 ,0 , 0 , 10 ,15 ,20 ,25 ,25 ,30},
niimurasyou 10:a765515594bd 73 {-50, -50, -50, -40, -35, -30, -23,-20, -15, -10 ,0 ,10 ,15 ,17 ,20},
niimurasyou 10:a765515594bd 74 {-60, -60, -57, -50, -45, -40, -35,-30, -25, -20 ,-10 ,0 ,10 ,13 ,17},
niimurasyou 10:a765515594bd 75 {-80, -71, -70, -60, -55, -50, -45,-40, -35, -30 ,-20 ,-10 ,0 ,10 ,13},
niimurasyou 10:a765515594bd 76 {-80, -80, -75, -70, -65, -60, -55,-50, -45, -40 ,-30 ,-20 ,-10 ,0 ,10},
niimurasyou 10:a765515594bd 77 {-80, -80, -80, -77, -75, -72, -71,-70, -60, -50 ,-40 ,-30 ,-20 ,-10 ,0}};
t_yamamoto 0:562021ed1ba9 78
t_yamamoto 0:562021ed1ba9 79
niimurasyou 10:a765515594bd 80
niimurasyou 10:a765515594bd 81
niimurasyou 10:a765515594bd 82
t_yamamoto 0:562021ed1ba9 83
niimurasyou 9:ec30ae33cc9e 84 int pwm_array[15] = { 30 , 25 , 20 , 15 , 10 , 5 , 0 , 0 , 0 , -5 , -10 , -15 , -20 , -25 , -30 };
niimurasyou 9:ec30ae33cc9e 85
niimurasyou 9:ec30ae33cc9e 86 #define usiro 0
niimurasyou 9:ec30ae33cc9e 87 #define mae 0
niimurasyou 9:ec30ae33cc9e 88 uint8_t motorData[5];
niimurasyou 9:ec30ae33cc9e 89 uint8_t pwmData[5];
niimurasyou 9:ec30ae33cc9e 90
niimurasyou 9:ec30ae33cc9e 91 int conlx;
niimurasyou 9:ec30ae33cc9e 92 int conly;
niimurasyou 9:ec30ae33cc9e 93 int conrx;
niimurasyou 9:ec30ae33cc9e 94 int conry;
niimurasyou 9:ec30ae33cc9e 95 int conba;
niimurasyou 9:ec30ae33cc9e 96 int conbb;
niimurasyou 9:ec30ae33cc9e 97 int conbx;
niimurasyou 9:ec30ae33cc9e 98 int conby;
t_yamamoto 0:562021ed1ba9 99
t_yamamoto 0:562021ed1ba9 100 //↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
t_yamamoto 0:562021ed1ba9 101 //_____________________
t_yamamoto 0:562021ed1ba9 102
t_yamamoto 8:cb53beff4bb2 103 //#define USE_USB_SERIAL
t_yamamoto 0:562021ed1ba9 104 #ifdef USE_USB_SERIAL
t_yamamoto 0:562021ed1ba9 105 Serial pc(SERIAL_TX, SERIAL_RX);
t_yamamoto 0:562021ed1ba9 106 #endif
t_yamamoto 0:562021ed1ba9 107 XBEE::ControllerData *controller;
t_yamamoto 0:562021ed1ba9 108 MOTOR::MotorStatus motor[MOUNTING_MOTOR_NUM];
t_yamamoto 0:562021ed1ba9 109
t_yamamoto 0:562021ed1ba9 110 using namespace SWITCH;
t_yamamoto 0:562021ed1ba9 111
t_yamamoto 8:cb53beff4bb2 112 void SystemProcess(void) {
t_yamamoto 0:562021ed1ba9 113 while(true) {
t_yamamoto 0:562021ed1ba9 114 controller = XBEE::Controller::GetData();
t_yamamoto 0:562021ed1ba9 115 //____________________________
t_yamamoto 0:562021ed1ba9 116 /*------------------------ HOW TO WRITE ------------------------/
t_yamamoto 0:562021ed1ba9 117
t_yamamoto 0:562021ed1ba9 118 ここにメインのプログラムを書く
t_yamamoto 0:562021ed1ba9 119
t_yamamoto 0:562021ed1ba9 120 ・コントローラから受け取ったデータをもとに動作のプログラムを書く
t_yamamoto 0:562021ed1ba9 121 (コントローラのデータは controller-> で取る)
t_yamamoto 0:562021ed1ba9 122
t_yamamoto 0:562021ed1ba9 123 if(controller->Button.RIGHT) {
t_yamamoto 0:562021ed1ba9 124 motor[TIRE_L].dir = FOR;
t_yamamoto 0:562021ed1ba9 125 motor[TIRE_R].dir = BACK;
t_yamamoto 7:f4252ddc480d 126 motor[TIRE_L].pwm = 12.3;
t_yamamoto 7:f4252ddc480d 127 motor[TIRE_R].pwm = 12.3;
t_yamamoto 0:562021ed1ba9 128 }
t_yamamoto 0:562021ed1ba9 129
t_yamamoto 6:c294736ba99d 130 motor[0].dirは FOR (正転)
t_yamamoto 0:562021ed1ba9 131 BACK (逆転)
t_yamamoto 0:562021ed1ba9 132 BRAKE (ブレーキ)
t_yamamoto 0:562021ed1ba9 133 FREE (フリー)
t_yamamoto 0:562021ed1ba9 134
t_yamamoto 0:562021ed1ba9 135 motor[0].pwmは 0.0(%) ~ 100.0(%)
t_yamamoto 0:562021ed1ba9 136
t_yamamoto 0:562021ed1ba9 137 controllerは XBee.hの構造体の中身
t_yamamoto 0:562021ed1ba9 138
t_yamamoto 0:562021ed1ba9 139 (AnalogL・Rを使いたかったら、頑張って考える or 聞いてください)
t_yamamoto 0:562021ed1ba9 140
t_yamamoto 0:562021ed1ba9 141 ・リミットスイッチの値をもとに動作のプログラムを書く
t_yamamoto 0:562021ed1ba9 142
t_yamamoto 0:562021ed1ba9 143 if(Switch::CheckPushed(ARM_L))
t_yamamoto 0:562021ed1ba9 144 {
t_yamamoto 0:562021ed1ba9 145 if(controller->Button.L)
t_yamamoto 0:562021ed1ba9 146 {
t_yamamoto 6:c294736ba99d 147 motor[ARM].dir = FOR;
t_yamamoto 0:562021ed1ba9 148 motor[ARM].pwm = 80.0;
t_yamamoto 0:562021ed1ba9 149 }
t_yamamoto 0:562021ed1ba9 150 if(motor[ARM].dir == BACK)
t_yamamoto 0:562021ed1ba9 151 {
t_yamamoto 0:562021ed1ba9 152 motor[ARM].dir = BRAKE;
t_yamamoto 0:562021ed1ba9 153 }
t_yamamoto 0:562021ed1ba9 154 }
t_yamamoto 0:562021ed1ba9 155
t_yamamoto 0:562021ed1ba9 156 →関数 Switch::CheckPushed の引数はリミットスイッチの名前 (limitSw[0]みたいな), 返り値はbool型 (true or false)
t_yamamoto 0:562021ed1ba9 157
t_yamamoto 0:562021ed1ba9 158 ・他にもやりたいことがあったら自由にどうぞ
t_yamamoto 0:562021ed1ba9 159
t_yamamoto 0:562021ed1ba9 160 ps.わからないことがあったら聞いてください
t_yamamoto 0:562021ed1ba9 161
t_yamamoto 0:562021ed1ba9 162 /------------------------ HOW TO WRITE ------------------------*/
t_yamamoto 0:562021ed1ba9 163 //↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
t_yamamoto 0:562021ed1ba9 164
niimurasyou 9:ec30ae33cc9e 165 conlx = controller->AnalogL.X;
niimurasyou 9:ec30ae33cc9e 166 conly = controller->AnalogL.Y;
niimurasyou 9:ec30ae33cc9e 167 conrx = controller->AnalogR.X;
niimurasyou 9:ec30ae33cc9e 168 conry = controller->AnalogR.Y;
niimurasyou 9:ec30ae33cc9e 169 //conba = controller->Button.A;
niimurasyou 9:ec30ae33cc9e 170 //conbb = controller->Button.B;
niimurasyou 9:ec30ae33cc9e 171 //conby = controller->Button.Y;
niimurasyou 9:ec30ae33cc9e 172 //conbx = controller->Button.X;
t_yamamoto 0:562021ed1ba9 173
niimurasyou 9:ec30ae33cc9e 174 if(((conlx >6) && (conly <8)) ||((conrx >6)&&(conry <8))){
niimurasyou 9:ec30ae33cc9e 175 motor[a].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 176 motor[b].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 177 motor[c].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 178 motor[a].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 179 motor[b].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 180 motor[c].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 181 }
t_yamamoto 0:562021ed1ba9 182
niimurasyou 9:ec30ae33cc9e 183 if(a_array[conly][conlx]<0){
niimurasyou 10:a765515594bd 184 motor[a].pwm = (-1*a_array[conly][conlx]*100)/90;
niimurasyou 9:ec30ae33cc9e 185 motor[a].dir = FOR;
niimurasyou 9:ec30ae33cc9e 186 }else if(a_array[conly][conlx] > 0){
niimurasyou 9:ec30ae33cc9e 187 motor[a].pwm = a_array[conly][conlx];
niimurasyou 10:a765515594bd 188 motor[a].dir = FOR;//
niimurasyou 9:ec30ae33cc9e 189 }else if(a_array[conly][conlx] == 0){
niimurasyou 9:ec30ae33cc9e 190 if(conry < 6){
niimurasyou 9:ec30ae33cc9e 191 motor[a].dir = BACK;
niimurasyou 9:ec30ae33cc9e 192 motor[b].dir = BACK;
niimurasyou 9:ec30ae33cc9e 193 motor[c].dir = BACK;
niimurasyou 9:ec30ae33cc9e 194 motor[a].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 195 motor[b].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 196 motor[c].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 197 }else if(conry > 8){
niimurasyou 9:ec30ae33cc9e 198 motor[a].dir = FOR;
niimurasyou 9:ec30ae33cc9e 199 motor[b].dir = FOR;
niimurasyou 9:ec30ae33cc9e 200 motor[c].dir = FOR;
niimurasyou 9:ec30ae33cc9e 201 motor[a].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 202 motor[b].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 203 motor[c].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 204 }else{
niimurasyou 9:ec30ae33cc9e 205 motor[a].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 206 motor[b].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 207 motor[c].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 208 motor[a].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 209 motor[b].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 210 motor[c].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 211 }
niimurasyou 9:ec30ae33cc9e 212 }
niimurasyou 9:ec30ae33cc9e 213
niimurasyou 9:ec30ae33cc9e 214 if(b_array[conly][conlx] <0 ){
niimurasyou 10:a765515594bd 215 motor[b].pwm = (-1*b_array[conly][conlx]*100)/90;
niimurasyou 9:ec30ae33cc9e 216 motor[b].dir = FOR;
niimurasyou 9:ec30ae33cc9e 217 }else if(b_array[conly][conlx] > 0){
niimurasyou 9:ec30ae33cc9e 218 motor[b].pwm = b_array[conly][conlx];
niimurasyou 10:a765515594bd 219 motor[b].dir = FOR;//
niimurasyou 9:ec30ae33cc9e 220 }else if(a_array[conly][conlx] == 0 ){
niimurasyou 9:ec30ae33cc9e 221 if(conrx < 6 ) {
niimurasyou 9:ec30ae33cc9e 222 motor[a].dir = BACK;
niimurasyou 9:ec30ae33cc9e 223 motor[b].dir = BACK;
niimurasyou 9:ec30ae33cc9e 224 motor[c].dir = BACK;
niimurasyou 9:ec30ae33cc9e 225 motor[a].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 226 motor[b].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 227 motor[c].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 228 }else if(conrx > 8){
niimurasyou 9:ec30ae33cc9e 229 motor[a].dir = FOR;
niimurasyou 9:ec30ae33cc9e 230 motor[b].dir = FOR;
niimurasyou 9:ec30ae33cc9e 231 motor[c].dir = FOR;
niimurasyou 9:ec30ae33cc9e 232 motor[a].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 233 motor[b].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 234 motor[c].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 235 }else{
niimurasyou 9:ec30ae33cc9e 236 motor[a].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 237 motor[b].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 238 motor[c].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 239 motor[a].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 240 motor[b].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 241 motor[c].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 242 }
niimurasyou 9:ec30ae33cc9e 243 }
niimurasyou 9:ec30ae33cc9e 244
niimurasyou 9:ec30ae33cc9e 245
niimurasyou 9:ec30ae33cc9e 246 if(c_array[conly][conlx] <0 ){
niimurasyou 10:a765515594bd 247 motor[c].pwm =(-1*c_array[conly][conlx]*100)/90;
niimurasyou 10:a765515594bd 248 motor[c].dir = FOR;//
niimurasyou 9:ec30ae33cc9e 249 }else if(c_array[conly][conlx] > 0){
niimurasyou 9:ec30ae33cc9e 250 motor[c].pwm = c_array[conly][conlx];
niimurasyou 9:ec30ae33cc9e 251 motor[c].dir = FOR;
niimurasyou 9:ec30ae33cc9e 252 }else if(a_array[conly][conlx] == 0 ){
niimurasyou 9:ec30ae33cc9e 253 if(conrx < 6 ) {
niimurasyou 9:ec30ae33cc9e 254 motor[a].dir = BACK;
niimurasyou 9:ec30ae33cc9e 255 motor[b].dir = BACK;
niimurasyou 9:ec30ae33cc9e 256 motor[c].dir = BACK;
niimurasyou 9:ec30ae33cc9e 257 motor[a].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 258 motor[b].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 259 motor[c].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 260 }else if(conrx > 8){
niimurasyou 9:ec30ae33cc9e 261 motor[a].dir = FOR;
niimurasyou 9:ec30ae33cc9e 262 motor[b].dir = FOR;
niimurasyou 9:ec30ae33cc9e 263 motor[c].dir = FOR;
niimurasyou 9:ec30ae33cc9e 264 motor[a].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 265 motor[b].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 266 motor[c].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 267 }else{
niimurasyou 9:ec30ae33cc9e 268 motor[a].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 269 motor[b].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 270 motor[c].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 271 motor[a].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 272 motor[b].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 273 motor[c].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 274 }
niimurasyou 9:ec30ae33cc9e 275
niimurasyou 9:ec30ae33cc9e 276 //
niimurasyou 9:ec30ae33cc9e 277 //if (a_array[conlx>6][conly<8]){
niimurasyou 9:ec30ae33cc9e 278 // motor[a].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 279 // motor[a].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 280 // }
niimurasyou 9:ec30ae33cc9e 281 //if (b_array[conlx>6][conly<8]){
niimurasyou 9:ec30ae33cc9e 282 // motor[b].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 283 // motor[b].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 284 // }
niimurasyou 9:ec30ae33cc9e 285 //if (c_array[conlx>6][conly<8]){
niimurasyou 9:ec30ae33cc9e 286 // motor[c].dir = BRAKE;
niimurasyou 9:ec30ae33cc9e 287 // motor[c].pwm = 100.0;
niimurasyou 9:ec30ae33cc9e 288 // }
niimurasyou 9:ec30ae33cc9e 289 //
niimurasyou 9:ec30ae33cc9e 290 //
niimurasyou 9:ec30ae33cc9e 291 //(conba)
niimurasyou 9:ec30ae33cc9e 292 //{aira=0;}
niimurasyou 9:ec30ae33cc9e 293 // if(conbb)
niimurasyou 9:ec30ae33cc9e 294 // {airb=0;}
niimurasyou 9:ec30ae33cc9e 295
niimurasyou 9:ec30ae33cc9e 296
niimurasyou 9:ec30ae33cc9e 297
niimurasyou 9:ec30ae33cc9e 298
niimurasyou 9:ec30ae33cc9e 299
niimurasyou 9:ec30ae33cc9e 300
niimurasyou 9:ec30ae33cc9e 301
niimurasyou 9:ec30ae33cc9e 302
niimurasyou 9:ec30ae33cc9e 303
niimurasyou 9:ec30ae33cc9e 304 }
niimurasyou 9:ec30ae33cc9e 305
niimurasyou 9:ec30ae33cc9e 306
niimurasyou 9:ec30ae33cc9e 307
niimurasyou 9:ec30ae33cc9e 308
niimurasyou 9:ec30ae33cc9e 309 //
niimurasyou 9:ec30ae33cc9e 310 //↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
niimurasyou 9:ec30ae33cc9e 311 //___________________________
t_yamamoto 0:562021ed1ba9 312
t_yamamoto 0:562021ed1ba9 313
niimurasyou 9:ec30ae33cc9e 314
t_yamamoto 0:562021ed1ba9 315 MOTOR::Motor::Update(motor);
t_yamamoto 0:562021ed1ba9 316 }
niimurasyou 9:ec30ae33cc9e 317 }