PID Kontrol atas, tanpa library. Baru P dan D, tapi D error
Dependencies: Motor mbed millis
Diff: main.cpp
- Revision:
- 2:89d69eae8917
- Parent:
- 1:accc8b66773b
- Child:
- 3:e4cbba0706b0
--- a/main.cpp Sat Oct 15 15:26:00 2016 +0000 +++ b/main.cpp Tue Oct 18 11:56:30 2016 +0000 @@ -25,7 +25,7 @@ float D, Kd; // Variabel Sabeb - int desired_rpm = 150; + int desired_rpm = 125; // Test Variabel int selisiherror; @@ -42,8 +42,8 @@ // Deklarasi awal PID last_errorD = 0; pwm_last = 0; - Kp = 0.000000007; - Kd = 0.000000000007; + Kp = 0.00000007; + Kd = 0.000000007; while(1){ @@ -65,7 +65,7 @@ // int counter; // counter=currentMillis/100; - if (currentMillis-previousMillis==500) + if (currentMillis-previousMillis==250) { previousMillis = currentMillis; rpm = encoder0Pos;