KRAI 2017
/
ESC_test
esc test kontrol atas
Revision 1:8b6c35986de0, committed 2016-09-26
- Comitter:
- franshendri
- Date:
- Mon Sep 26 08:40:53 2016 +0000
- Parent:
- 0:7388487b63fb
- Commit message:
- code terbaru buat ESC, udah dicoba dan siap pakai
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 7388487b63fb -r 8b6c35986de0 main.cpp --- 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); - } } }