Dependencies:   mbed

main.cpp

Committer:
jderemer3
Date:
2017-03-01
Revision:
0:30ef0b226adf

File content as of revision 0:30ef0b226adf:

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