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: Motor PID mbed millis
Fork of Encoder_Base_NasioanalV1 by
Revision 2:9cf609b74de9, committed 2017-05-29
- Comitter:
- rahmadirizki18
- Date:
- Mon May 29 17:01:57 2017 +0000
- Parent:
- 1:7d3041941b1b
- Child:
- 3:db2dc06c0686
- Commit message:
- Baca kiri dan kanan
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon May 29 15:46:48 2017 +0000
+++ b/main.cpp Mon May 29 17:01:57 2017 +0000
@@ -17,6 +17,7 @@
/* SETTINGS (WAJIB!) : */
/* 1. Settings Pin Encoder, Resolusi, dan Tipe encoding */
/* 2. Deklarasi penggunaan library pada bagian deklarasi encoder */
+/* 3. Searah jarum jam positif 517 pulse 1 putaran enc Atas, 524 kiri */
/* */
/****************************************************************************/
@@ -50,11 +51,26 @@
Serial pc(USBTX,USBRX);
/* Deklarasi Encoder Launcher */
-encoderKRAI encKiri( PC_10, PC_11, 28, encoderKRAI::X4_ENCODING);
-encoderKRAI encKanan( PC_12, PD_2, 28, encoderKRAI::X4_ENCODING);
+encoderKRAI encKiri( PB_5, PB_4, 28, encoderKRAI::X4_ENCODING);
+encoderKRAI encAtas( PA_15, PA_14, 28, encoderKRAI::X4_ENCODING);
/* Deklarasi Motor Base */
-Motor motorDpn(PB_7, PC_3, PC_0); //(PB_9, PA_12, PC_5);
+Motor motorDpn(PB_7, PC_3, PC_0); //(PB_9, PA_12, PC_5);
Motor motorBlk(PB_2, PB_15, PB_1);
Motor motorL (PB_9, PA_12, PA_6);
-Motor motorR (PB_8, PC_6, PC_5); //(PC_6, PB_4, PB_5);
\ No newline at end of file
+Motor motorR (PB_8, PC_6, PC_5); //(PC_6, PB_4, PB_5);
+
+void setCenter(){
+/* Fungsi untuk menentukan center dari robot */
+ encKiri.reset();
+ encAtas.reset();
+}
+
+int main(void){
+ pc.baud(115200);
+ setCenter();
+ while(1){
+ pc.printf("kiri %d, atas %d \n",(int)encKiri.getPulses(),(int)encAtas.getPulses());
+ //wait_ms(500);
+ }
+}
\ No newline at end of file
