Leds variable flash

Dependencies:   mbed

main.cpp

Committer:
jaume
Date:
2010-10-28
Revision:
0:e9da4640a8a0

File content as of revision 0:e9da4640a8a0:

// Parpadeo.- JaumeB
#include "mbed.h"
DigitalOut mbled0(LED1);
DigitalOut mbled1(LED2);
DigitalOut mbled2(LED3);
DigitalOut mbled3(LED4);
int main() {
    int interval = 30;
    while(1) {
        mbled0 = 1;wait_ms(interval);mbled1 = 1;wait_ms(interval);        
        mbled2 = 1;wait_ms(interval);mbled3 = 1;wait_ms(interval);
        interval++;
        if (interval>60){
             mbled0 = 0;mbled1 = 0;mbled2 = 0;mbled3 = 0;
             mbled1 =1;wait_ms(interval); mbled2 = 1;
             wait_ms(interval*10);
             interval=0;
        }                    
        mbled2 = 0;wait_ms(interval);mbled1 = 0;wait_ms(interval);        
        mbled0 = 0;wait_ms(interval);mbled3 = 0;wait_ms(interval);
    }
}