Playing with PWM on the Nucleo board.

Dependencies:   mbed

main.cpp

Committer:
bgrissom
Date:
2014-07-03
Revision:
0:1870a0163767

File content as of revision 0:1870a0163767:

#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);
    }
}