base versi 1 motherboard prototype
Dependencies: Motor NewTextLCD PID mbed
Revision 2:23fe981b6ef7, committed 2015-12-19
- Comitter:
- rizqicahyo
- Date:
- Sat Dec 19 00:03:45 2015 +0000
- Parent:
- 1:33203568631b
- Commit message:
- debug manual driving
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Dec 18 23:35:16 2015 +0000 +++ b/main.cpp Sat Dec 19 00:03:45 2015 +0000 @@ -291,8 +291,8 @@ void running() //prosedur utama untuk kendali robot { - float speed=0; - float k; + float speed=gMax_speed; + float k=1; switch(gCase) { @@ -335,10 +335,10 @@ } pc.printf("\n"); } - else + else if(!PS3.silang) { - motor_kiri.brake(1); - motor_kanan.brake(1); + motor_kiri.brake(0); + motor_kanan.brake(0); pc.printf("PID stop \n"); } } @@ -400,19 +400,19 @@ motor_kanan.speed(-speed*k*0.7); pc.printf("piv kanan \n"); } - else + else if (!PS3.atas && !PS3.bawah && !PS3.L1 && !PS3.R1) { - motor_kiri.brake(1); - motor_kanan.brake(1); + motor_kiri.brake(0); + motor_kanan.brake(0); pc.printf("stop \n"); } - if(PS3.L2 == 255 && PS3.R2 == 0) + /*if(PS3.L2 == 255 && PS3.R2 == 0) k=0.5; else if (PS3.L2 == 0 && PS3.R2 == 255) k=2; else - k=1; + k=1;*/ } else { @@ -458,7 +458,7 @@ pc.baud(115200); //multitasking untuk menampilkan layar - timer.attach(&showLCD,0.8); + timer.attach(&showLCD,1); while(1){ PS3.idle();