esc test kontrol atas

Dependencies:   ESC mbed

Revision:
1:8b6c35986de0
Parent:
0:7388487b63fb
--- a/main.cpp	Sun Sep 25 05:58:05 2016 +0000
+++ b/main.cpp	Mon Sep 26 08:40:53 2016 +0000
@@ -1,24 +1,30 @@
 #include "mbed.h"
 #include "esc.h"
  
-ESC edf(PC_6,20);
+ESC edf(D9,20);
 Serial pc(USBTX,USBRX);
 
-float max = 0.5;
-
-float pwm;
+float max = 0.3;
+float pwm = 0;
 
 int main() {
     
     pc.baud(9600);
     edf.setThrottle(pwm);
     edf.pulse();
+    wait_ms (5000);
     
     while(1) {
-        for (pwm = 0; pwm <max; pwm+=0.01){
+        
+        if ( pwm < max){
+            pwm += 0.01;
+        }
+        else{
+            pwm = max;
+        }
+        
             edf.setThrottle(pwm);
             edf.pulse();   
             wait_ms(70);  
-        }
     }
 }