Keiju Nakano
/
mbed_blinky_analog
Platform : mbed LPC1114FN28 , pwmが更新する度に長時間停波するので今回の用途にはつかえない
main.cpp
- Committer:
- maxonK
- Date:
- 2015-05-05
- Revision:
- 0:5ac8ea653724
File content as of revision 0:5ac8ea653724:
#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); } }