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
main.cpp
- Committer:
- OCHIRIO
- Date:
- 2018-11-27
- Revision:
- 4:af3ab563a296
- Parent:
- 3:49bf69fdf479
File content as of revision 4:af3ab563a296:
#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(period); // PWM周期を4秒に設定 led.write(duty); // デューティー比を 50% に設定(つまり2秒点灯・2秒消灯の繰り返し) } } //pc.getc(); //限界値を設定する //printfは重くなりやすい...??