![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Kode Taker 2018
Dependencies: mbed PS_PAD encoderKRAI Motor_1 millis
Diff: main.cpp
- Revision:
- 1:1dc7c9cb4f8c
- Parent:
- 0:8c6f29487664
--- a/main.cpp Tue Jul 03 05:45:18 2018 +0000 +++ b/main.cpp Tue Jul 03 13:52:06 2018 +0000 @@ -428,7 +428,8 @@ if (countX>5 && countX<=300) { pn2=0; - countX=325; + pn3=0; + countX=375; if (pn<5 && pn>=0) pn++; else @@ -465,7 +466,8 @@ if (countKotak>5 && countKotak<300){ pn=0; - countKotak=325; + pn3=0; + countKotak=575; if (pn2<5 && pn2>=0) pn2++; else @@ -496,27 +498,42 @@ if (ps2.read(PS_PAD::PAD_TRIANGLE)==1 && countSegitiga<400) countSegitiga++; - if (countSegitiga>=7 && countSegitiga<300){ + if (countSegitiga>=5 && countSegitiga<300){ //SEGITIGA : buka tutup kedua gripper - countSegitiga=500; + countSegitiga=575; pneumatik[0]=!pneumatik[0]; pneumatik[1]=!pneumatik[1]; pneumatik[2]=1; pneumatik[3]=1; pn=0; pn2=0; + pn3=0; } if (ps2.read(PS_PAD::PAD_CIRCLE)==1 && countCircle<400) countCircle++; - if (countCircle>=5 && countCircle<200){ + if (countCircle>=5 && countCircle<300){ //LINGKARAN : glider AB mundur, gripper AB buka, (kombinasikan dg kotak utk passing golde sc) - countCircle=500; - pneumatik[0]=0; //gripA - pneumatik[1]=0; //gripB - pneumatik[2]=1; //sliderA - pneumatik[3]=1; //sliderB + countCircle=575; + if (pn3<2 && pn3>=0) + pn3++; + else + pn3=0; + + if(pn3==0){ + pneumatik[0]=1; + pneumatik[1]=1; + pneumatik[2]=1; + pneumatik[3]=1; + } else if(pn3==1){ + pneumatik[3]=0; + } else if(pn3==2){ + pneumatik[1]=0; + wait_ms(50); + pneumatik[1]=0; + pneumatik[3]=1; + } pn=0; pn2=0; }