Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:30ef0b226adf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Mar 01 16:38:41 2017 +0000 @@ -0,0 +1,20 @@ +#include "mbed.h" + +PwmOut driv(p21); + +int main() { + // specify period first + driv.period(0.0125f); // 4 second period + //driv.write(0.5f); // 50% duty cycle, relative to period + //led = 0.5f; // shorthand for led.write() + //led.pulsewidth(2); // alternative to led.write, set duty cycle time in seconds + while(1) + { + for (int i = 0; i < 10; i++) + { + float inc = i*0.1f; + driv.write(inc); + wait(1); + } + } +} \ No newline at end of file