Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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 |
--- 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);
- }
}
}