
use the Pwmout Class to make a breathing led.
Dependencies: mbed
Fork of PwmOut_HelloWorld by
Revision 2:f3c392d271f9, committed 2014-10-17
- Comitter:
- shiyilei
- Date:
- Fri Oct 17 05:43:09 2014 +0000
- Parent:
- 1:5160ea45399b
- Commit message:
- use the Pwmout Class to make a breathing led.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 5160ea45399b -r f3c392d271f9 main.cpp --- a/main.cpp Sun Sep 21 06:39:30 2014 +0000 +++ b/main.cpp Fri Oct 17 05:43:09 2014 +0000 @@ -1,12 +1,17 @@ +/***************************************** +*File:breathing led +*Creator:JacobShi +*Time:2014/10/17 +*Description: use the pwm mode to make +*a breathing led. +******************************************/ #include "mbed.h" - PwmOut led(LED1); - int main() { - // specify period first - led.period(4.0f); // 4 second period - led.write(0.50f); // 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); + led.period(1); + led.pulsewidth(0.5); + while(1) + { + + } } \ No newline at end of file