esc test kontrol atas

Dependencies:   ESC mbed

Committer:
Najib_irvani
Date:
Sun Sep 25 05:58:05 2016 +0000
Revision:
0:7388487b63fb
Child:
1:8b6c35986de0
contoh program untuk esc kontrol atas

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Najib_irvani 0:7388487b63fb 1 #include "mbed.h"
Najib_irvani 0:7388487b63fb 2 #include "esc.h"
Najib_irvani 0:7388487b63fb 3
Najib_irvani 0:7388487b63fb 4 ESC edf(PC_6,20);
Najib_irvani 0:7388487b63fb 5 Serial pc(USBTX,USBRX);
Najib_irvani 0:7388487b63fb 6
Najib_irvani 0:7388487b63fb 7 float max = 0.5;
Najib_irvani 0:7388487b63fb 8
Najib_irvani 0:7388487b63fb 9 float pwm;
Najib_irvani 0:7388487b63fb 10
Najib_irvani 0:7388487b63fb 11 int main() {
Najib_irvani 0:7388487b63fb 12
Najib_irvani 0:7388487b63fb 13 pc.baud(9600);
Najib_irvani 0:7388487b63fb 14 edf.setThrottle(pwm);
Najib_irvani 0:7388487b63fb 15 edf.pulse();
Najib_irvani 0:7388487b63fb 16
Najib_irvani 0:7388487b63fb 17 while(1) {
Najib_irvani 0:7388487b63fb 18 for (pwm = 0; pwm <max; pwm+=0.01){
Najib_irvani 0:7388487b63fb 19 edf.setThrottle(pwm);
Najib_irvani 0:7388487b63fb 20 edf.pulse();
Najib_irvani 0:7388487b63fb 21 wait_ms(70);
Najib_irvani 0:7388487b63fb 22 }
Najib_irvani 0:7388487b63fb 23 }
Najib_irvani 0:7388487b63fb 24 }