
test
Diff: servotest.cpp
- Revision:
- 0:788cb11e78c0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/servotest.cpp Tue Nov 24 05:47:07 2015 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" + +PwmOut pwm(p21); + +int main() { + int start=510, end=2390; + while(1){ + pwm.pulsewidth_us(start); + wait(5); + for(int p = start; p < end; p += 20) { + pwm.pulsewidth_us(p); + wait_ms(40); + } + pwm.pulsewidth_us(end); + wait(5); + for(int p = end; p >=start; p -= 20) { + pwm.pulsewidth_us(p); + wait_ms(40); + } + } +} \ No newline at end of file