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
Diff: main.cpp
- Revision:
- 0:9df24d9c5f46
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Mar 26 10:38:54 2019 +0000 @@ -0,0 +1,14 @@ +/*Program Example 5.2: Uses analog input to control PWM duty cycle, fixed period + */ +#include "mbed.h" +PwmOut PWM1(p21); +AnalogIn Ain(p20); //defines analog input on Pin 20 + +int main() { + while(1) { + PWM1.period(Ain/1000 + 0.001); + PWM1=Ain; + wait(0.5); + } +} +