pwm

Dependencies:   mbed

main.cpp

Committer:
OscarLiao
Date:
2018-12-13
Revision:
0:b45c510cc04a

File content as of revision 0:b45c510cc04a:

#include "mbed.h"

PwmOut mypwm(D6);

DigitalOut myled(LED1);

int main() {
    
    mypwm.period_us(15000);
    mypwm.pulsewidth_us(2100);  
  
    printf("pwm set to %.2f %%\n", mypwm.read() * 100);
    
    while(1) {
        myled = !myled;
        wait(1);
    }
}