Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Revision 4:af3ab563a296, committed 2018-11-27
- Comitter:
- OCHIRIO
- Date:
- Tue Nov 27 10:10:35 2018 +0000
- Parent:
- 3:49bf69fdf479
- Commit message:
- ???????????????????
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Jul 27 15:56:19 2018 +0000 +++ b/main.cpp Tue Nov 27 10:10:35 2018 +0000 @@ -1,10 +1,26 @@ #include "mbed.h" +Serial pc (USBTX, USBRX); PwmOut led(dp24); // dp24ピンをPWM出力として利用、led変数に割当 int main() { + float period, duty; + while(1){ // 「何もしない」状態を無限に繰り返す → 上記で設定したPWM制御の状態がずっと続く + pc.printf("Input period: "); + pc.scanf("%d", &period); + pc.printf("\r\n"); + + pc.printf("Input duty: "); + pc.scanf("%d", &duty); + pc.printf("\r\n"); + // specify period first - led.period(2.0f); // PWM周期を4秒に設定 - led.write(0.50f); // デューティー比を 50% に設定(つまり2秒点灯・2秒消灯の繰り返し) - while(1); // 「何もしない」状態を無限に繰り返す → 上記で設定したPWM制御の状態がずっと続く -} \ No newline at end of file + led.period(period); // PWM周期を4秒に設定 + led.write(duty); // デューティー比を 50% に設定(つまり2秒点灯・2秒消灯の繰り返し) + } +} + +//pc.getc(); + +//限界値を設定する +//printfは重くなりやすい...?? \ No newline at end of file