Bismarck / Mbed 2 deprecated ESC_TEST_CODE

Dependencies:   mbed

Committer:
tsillen
Date:
Thu Apr 30 21:57:52 2015 +0000
Revision:
0:40a2ad5e1ba6
Working code, verified with scope

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tsillen 0:40a2ad5e1ba6 1 #include "mbed.h"
tsillen 0:40a2ad5e1ba6 2
tsillen 0:40a2ad5e1ba6 3 PwmOut mypwm(A0);
tsillen 0:40a2ad5e1ba6 4
tsillen 0:40a2ad5e1ba6 5 DigitalOut myled(LED1);
tsillen 0:40a2ad5e1ba6 6
tsillen 0:40a2ad5e1ba6 7 int main() {
tsillen 0:40a2ad5e1ba6 8
tsillen 0:40a2ad5e1ba6 9 mypwm.period_ms(20); //20ms period voor esc
tsillen 0:40a2ad5e1ba6 10 mypwm.pulsewidth_us(1500); //neutraal voor cal
tsillen 0:40a2ad5e1ba6 11 wait(3); //give esc cal neutral some time , this is just a random value
tsillen 0:40a2ad5e1ba6 12 mypwm.pulsewidth_us(1400); //reverse
tsillen 0:40a2ad5e1ba6 13 wait(1);
tsillen 0:40a2ad5e1ba6 14 mypwm.pulsewidth_us(1600); //forward
tsillen 0:40a2ad5e1ba6 15 wait(1);
tsillen 0:40a2ad5e1ba6 16 mypwm.pulsewidth_us(1500); //neutraal
tsillen 0:40a2ad5e1ba6 17
tsillen 0:40a2ad5e1ba6 18
tsillen 0:40a2ad5e1ba6 19 // printf("pwm set to %.2f %%\n", mypwm.read() * 100);
tsillen 0:40a2ad5e1ba6 20 // while(1) {
tsillen 0:40a2ad5e1ba6 21 // myled = !myled;
tsillen 0:40a2ad5e1ba6 22 // wait(1);
tsillen 0:40a2ad5e1ba6 23 // }
tsillen 0:40a2ad5e1ba6 24 }