My Pwm program with method number 1

Dependencies:   mbed

main.cpp

Committer:
neutron_striker
Date:
2015-02-15
Revision:
0:102eab0a783a

File content as of revision 0:102eab0a783a:

#include "mbed.h"

PwmOut mypwm(LED1);

//DigitalOut myled(LED1);

int main() {
    
    mypwm.period_ms(10);
    mypwm.pulsewidth_ms(1);
  
    printf("pwm set to %.2f %%\n", mypwm.read() * 100);
    
    while(1) {
        for(uint8_t i=0;i<10;i++)
        {
            mypwm.pulsewidth_ms(i);
            wait(0.03);   
        }
  //      myled = !myled;
      //  wait(1);
    }
}