Keiju Nakano
/
mbed_blinky_analog
Platform : mbed LPC1114FN28 , pwmが更新する度に長時間停波するので今回の用途にはつかえない
Revision 0:5ac8ea653724, committed 2015-05-05
- Comitter:
- maxonK
- Date:
- Tue May 05 08:25:50 2015 +0000
- Commit message:
- 0.5s???pwm?????????????????mbed?????pwm?????????????????????????
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue May 05 08:25:50 2015 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" + +AnalogIn position(dp4); +PwmOut servo(dp1); + +Serial device (USBTX,USBRX); + +int main() +{ + // servo requires a 20ms period + servo.period(0.015f); + while (1) { + wait(0.5); + // servo position determined by a pulse width between 1-2ms + servo.pulsewidth(0.001f + 0.001f * position); + + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue May 05 08:25:50 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8ab26030e058 \ No newline at end of file