高石 龍河
/
Servomotor_example
use servo motor with "for"
Diff: main.cpp
- Revision:
- 0:ac013d743554
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Apr 06 09:35:44 2019 +0000 @@ -0,0 +1,13 @@ +#include "mbed.h" + +PwmOut servo(D10); + +int main() { + servo.period(0.020); + while(1) { + for(float offset = 0.0f; offset < 0.001f; offset += 0.0001f){ + servo.pulsewidth(0.001f + offset); + wait(0.25); + } + } +}