日本語コメント付き
Dependencies: mbed
Fork of PwmOut_HelloWorld_mbedos2 by
main.cpp@3:49bf69fdf479, 2018-07-27 (annotated)
- Committer:
- yokotay
- Date:
- Fri Jul 27 15:56:19 2018 +0000
- Revision:
- 3:49bf69fdf479
- Parent:
- 2:51cd5763b12f
?????????;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:50d2b9c62765 | 1 | #include "mbed.h" |
mbedAustin | 1:5160ea45399b | 2 | |
yokotay | 3:49bf69fdf479 | 3 | PwmOut led(dp24); // dp24ピンをPWM出力として利用、led変数に割当 |
mbedAustin | 1:5160ea45399b | 4 | |
mbed_official | 0:50d2b9c62765 | 5 | int main() { |
mbedAustin | 1:5160ea45399b | 6 | // specify period first |
yokotay | 3:49bf69fdf479 | 7 | led.period(2.0f); // PWM周期を4秒に設定 |
yokotay | 3:49bf69fdf479 | 8 | led.write(0.50f); // デューティー比を 50% に設定(つまり2秒点灯・2秒消灯の繰り返し) |
yokotay | 3:49bf69fdf479 | 9 | while(1); // 「何もしない」状態を無限に繰り返す → 上記で設定したPWM制御の状態がずっと続く |
mbed_official | 0:50d2b9c62765 | 10 | } |