Blinks the LEDs of mBuino one at a time from left to right, then back right to left, then they all stream on from left to right, and shut off from right to left.

Dependencies:   mbed

main.cpp

Committer:
Experiment626
Date:
2014-07-14
Revision:
0:aa0e1ad88af5

File content as of revision 0:aa0e1ad88af5:

#include "mbed.h"

DigitalOut LED[] = {(P0_7), (P0_8), (P0_2), (P0_20), (P1_19), (P0_17), (P0_23)};// declare 7 LEDs

float delayTime = .05;

int main()
{
    while(1)
    {
        delayTime = 0.05;
        for(int x = 0; x < 7; x++)
        {
            LED[x] = 1; // turn on
            wait(.2); // delay
        
            LED[x] = 0; // turn off
            wait(delayTime); // delay
        }
        for(int x = 6; x >= 0; x--)
        {
            LED[x] = 1; // turn on
            wait(.2); // delay
        
            LED[x] = 0; // turn off
            wait(delayTime); // delay
        }

        for(int x = 0; x < 7; x++)
        {
            LED[x] = 1; // turn on
            wait(delayTime); // delay
        }
        for(int x = 6; x >= 0; x--)
        {
            LED[x] = 0; // turn off
            wait(delayTime); // delay
        }
        

    }
}