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 Ultrasonic encoderKRAI mbed millis odometryKRAI pidKRAI
Diff: main.cpp
- Revision:
- 12:84cb23216f78
- Parent:
- 11:d4cf81f59601
--- a/main.cpp Wed Oct 25 15:16:27 2017 +0000
+++ b/main.cpp Sat Mar 31 01:44:42 2018 +0000
@@ -1,7 +1,7 @@
-/**
- * THROWER ROBOT
- * Bismillahirahmanirrahim
- *
+/*******************************************
+ * THROWER ROBOT *
+ * Bismillahirahmanirrahim *
+ * *
* To do List :
* - Cari konstanta Kanan Kiri
* - Cari Konstanta lagi :(
@@ -12,7 +12,7 @@
* - PID maju/mundur enak enak jos
*
* Last Edited by : Thrower KRAI
- **/
+ ********************************************/
//LIBRARY
@@ -22,12 +22,15 @@
#include "millis.h"
#include "pidKRAI.h"
#include "odometryKRAI.h"
+#include "Ultrasonic.h"
/***************************
* Konstanta dan Variabel *
***************************/
#define DRODA 100.0
+//ultrasonic
+Ultrasonic US(PA_7, PD_2);
//Variabel Robot
double kll_roda = PI*DRODA; //variabel keliling robot
@@ -151,7 +154,7 @@
motor_kanan.speed(pwm_kanan);
motor_kiri.speed(pwm_kiri);
//prev_millis2 = current_millis;
- //pc.printf("%.2f %.2f %.2f %.2f %.2f\n", jarak_y, d_tetha, pulses_depan, pulses_kanan, pulses_kiri);
+ pc.printf("%.2f %.2f %.2f %.2f %.2f\n", jarak_y, d_tetha, pulses_depan, pulses_kanan, pulses_kiri);
}
if((jarak_x <= target_x[state]-(float)5.0)||(jarak_x >= target_x[state]+(float)5.0)){
/* masuk ke case sumbu X */