Simple demo for Hackaday. PWM blinks an LED connected to pin 1

Dependencies:   mbed

main.cpp

Committer:
wd5gnr
Date:
2015-10-03
Revision:
0:af8bf6fc6a0f

File content as of revision 0:af8bf6fc6a0f:

#include "mbed.h"

PwmOut myled(dp1);

int main() 
{
    int i,j;
    while(1) 
       {
        for (j=0;j<2;j++)
            for (i=0;i<1000;i+=10)
                {
                float pwm=i/1000.0;
                myled=j?1.0-pwm:pwm;
                wait(0.01);
                }
       }
}