Project OKI
/
2021_08_28_Servo_practice1
SG-90 サーボ動作
main.cpp
- Committer:
- follow
- Date:
- 2021-08-29
- Revision:
- 0:9f597b7a29d4
File content as of revision 0:9f597b7a29d4:
/* 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); } }