![](/media/cache/profiles/16af635d9bcc11766919e03aebcb8cf8.jpg.50x50_q85.jpg)
Fading LEDs
main.cpp
- Committer:
- condorxan
- Date:
- 2013-09-07
- Revision:
- 0:e9e7bf4c3d88
File content as of revision 0:e9e7bf4c3d88:
#include "mbed.h" PwmOut rate1(LED1); PwmOut rate2(LED2); PwmOut rate3(LED3); PwmOut rate4(LED4); int main() { while(1) { for(float p=0; p<1.0; p += 0.01) { rate1 = p; wait(0.01); } for(float p=0; p<1.0; p += 0.01) { rate2 = p; wait(0.01); } for(float p=0; p<1.0; p += 0.01) { rate3 = p; wait(0.01); } for(float p=0; p<1.0; p += 0.01) { rate4 = p; wait(0.01); } for(float p=1; p>0; p = p- 0.01) { rate4 = p; wait(0.01); } for(float p=1; p>0; p = p- 0.01) { rate3 = p; wait(0.01); } for(float p=1; p>0; p = p- 0.01) { rate2 = p; wait(0.01); } for(float p=1; p>0; p = p- 0.01) { rate1 = p; wait(0.01); } wait(0.1); } }