PWMでLチカ

Dependencies:   mbed

main.cpp

Committer:
hirobe0913
Date:
2015-11-14
Revision:
0:d37007237832

File content as of revision 0:d37007237832:

#include "mbed.h"

/*
DigitalOut myled(dp18);

int main() {
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}
*/

// Fade a led on.
#include "mbed.h"
 
PwmOut led(dp18);
 
int main() {
    while(1) {
        led = led + 0.01;
        wait(0.2);
        if(led == 1.0) {
            led = 0;
        }
    }
}