board baru, pin baru

Dependencies:   DigitDisplay Motor PID Ping mbed millis

Fork of MainProgram_BaseBaru_fix_omni_25Mar by KRAI 2017

Files at this revision

API Documentation at this revision

Comitter:
rahmadirizki18
Date:
Mon Mar 27 14:07:02 2017 +0000
Parent:
44:e23f6d8586c6
Commit message:
board baru

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r e23f6d8586c6 -r 8af41da7fcd6 main.cpp
--- a/main.cpp	Sun Mar 26 03:32:56 2017 +0000
+++ b/main.cpp	Mon Mar 27 14:07:02 2017 +0000
@@ -127,37 +127,37 @@
 Serial pc(USBTX,USBRX);
 
 /* Deklarasi Encoder Base */
-encoderKRAI encoderBase(PC_4, PB_15, 2000, encoderKRAI::X2_ENCODING);   //inA, inB, pin Indeks (NC = tak ada), 2xresolusi, mode pembacaan
+//encoderKRAI encoderBase(PC_4, PB_15, 2000, encoderKRAI::X2_ENCODING);   //inA, inB, pin Indeks (NC = tak ada), 2xresolusi, mode pembacaan
 
 /* Deklarasi Encoder Launcher */
 encoderKRAI encLauncherDpn( PC_10, PC_11, 28, encoderKRAI::X4_ENCODING);
 encoderKRAI encLauncherBlk( PD_2, PC_12, 28, encoderKRAI::X4_ENCODING);
 
 /* Deklarasi Motor Base */
-Motor motorDpn(PC_7, PC_13, PC_14); //(PB_9, PA_12, PC_5);
-Motor motorBlk(PB_9, PC_5, PA_12);  //(PB_6, PB_1, PB_12); (PC_7, PC_14, PC_13); 
-Motor motorL  (PA_11, PA_6, PA_7);  
-Motor motorR  (PC_6, PB_5, PB_4);   //(PC_6, PB_4, PB_5);
+Motor motorDpn(PB_7, PC_3, PC_0); 
+Motor motorBlk(PB_6, PC_13, PC_14);
+Motor motorL  (PB_9, PA_12, PA_6);  
+Motor motorR  (PB_8, PC_5, PC_6); 
 
 /* Deklarasi Motor Launcher */
-Motor launcherDpn(PA_8,PC_2,PC_1);    // pwm ,fwd, rev
-Motor launcherBlk(PB_7, PA_14, PA_15); // pwm, fwd, rev 
-Motor powerScrew(PA_9, PA_4, PC_15); // pwm, fwd, rev                
+Motor launcherDpn(PA_5,PA_11,PB_12);
+Motor launcherBlk(PB_3, PA_10, PC_4); 
+Motor powerScrew(PB_10, PB_13, PB_14); // pwm, fwd, rev                
 
 /* Deklarasi Penumatik Launcher */
-DigitalOut pneumatik(PB_3, PullUp);
+DigitalOut pneumatik(PA_4, PullUp);
 
 /*Dekalrasi Limit Switch */
 //DigitalIn infraAtas(PC_9, PullUp);
-DigitalIn limitTengah(PB_10, PullUp);
-DigitalIn limitBawah(PC_8, PullUp);
-DigitalIn limitBawah1(PA_5, PullUp);
+DigitalIn limitTengah(PA_9, PullUp);
+DigitalIn limitBawah(PC_7, PullUp);
+DigitalIn limitBawah1(PC_2, PullUp);
 
 /*deklarasi PING ultrasonic*/
-Ping pingAtas(PC_9);
+Ping pingAtas(PC_15);
 
 /*Deklarasi Display*/
-DigitDisplay display (D15, D4);
+DigitDisplay display (PA_8, PC_8);
 
 /****************************************************/
 /*         Deklarasi Fungsi dan Procedure           */
@@ -293,7 +293,7 @@
     else if ((joystick.kotak_click)&&(!joystick.lingkaran_click)) {   
         // Power Screw Down
         caseJoystick = 12;       
-    } 
+    } else caseJoystick = 999;
     
     return(caseJoystick);
 }
@@ -301,10 +301,10 @@
 float getTetha(){
 // Fungsi untuk mendapatkan nilai tetha
     float busur, tetha;
-    busur = ((encoderBase.getPulses())/(float)(2000.0)*keliling_enc);
-    tetha = busur/keliling_robot*360;
+   // busur = ((encoderBase.getPulses())/(float)(2000.0)*keliling_enc);
+   // tetha = busur/keliling_robot*360;
     
-    return -(tetha);    
+   // return -(tetha);    
 }
 
 float pidBase(float Kp, float Ki, float Kd)
@@ -318,7 +318,7 @@
 
 void setCenter(){
 // Fungsi untuk menentukan center dari robot
-    encoderBase.reset();
+   // encoderBase.reset();
 }
 
 void init_rpm (){