Playing with PWM on the Nucleo board.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:1870a0163767
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jul 03 19:54:55 2014 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" + +PwmOut mypwm(D9); + +DigitalOut myled(LED1); + +int main() { + + //mypwm.write(0.1f); // 50% duty cycle + mypwm.period_us(2); + mypwm.pulsewidth_us(1); + + printf("pwm set to %.2f %%\n", mypwm.read() * 100); + + while(1) { + myled = !myled; + wait(1); + } +}