esc test kontrol atas

Dependencies:   ESC mbed

main.cpp

Committer:
franshendri
Date:
2016-09-26
Revision:
1:8b6c35986de0
Parent:
0:7388487b63fb

File content as of revision 1:8b6c35986de0:

#include "mbed.h"
#include "esc.h"
 
ESC edf(D9,20);
Serial pc(USBTX,USBRX);

float max = 0.3;
float pwm = 0;

int main() {
    
    pc.baud(9600);
    edf.setThrottle(pwm);
    edf.pulse();
    wait_ms (5000);
    
    while(1) {
        
        if ( pwm < max){
            pwm += 0.01;
        }
        else{
            pwm = max;
        }
        
            edf.setThrottle(pwm);
            edf.pulse();   
            wait_ms(70);  
    }
}