![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
SG-90 サーボ動作
Revision 0:9f597b7a29d4, committed 2021-08-29
- Comitter:
- follow
- Date:
- Sun Aug 29 11:42:50 2021 +0000
- Commit message:
- SG-90Servo;
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 |
diff -r 000000000000 -r 9f597b7a29d4 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Aug 29 11:42:50 2021 +0000 @@ -0,0 +1,25 @@ +/* +2021/08/29 +mbed nucleo STM32F401 + +プログラム内容: + SG-90を動作させるプログラム + -90°~90°に動作させる。 + 出力ポート:A3 +*/ +#include "mbed.h" + +PwmOut PWM(A3); //初期化 +int main() { + PWM.period_us(20000); //周期設定 + while (1) { + PWM.pulsewidth_us(500); //パルス幅変更 + wait(1); + PWM.pulsewidth_us(1450); + wait(1); + PWM.pulsewidth_us(500); + wait(1); + PWM.pulsewidth_us(2400); + wait(1); + } +} \ No newline at end of file
diff -r 000000000000 -r 9f597b7a29d4 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Aug 29 11:42:50 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file