mbed workshop intro + cansat examples

Countdown2.cpp

Committer:
yamaguch
Date:
2012-05-10
Revision:
0:f309f06aeec7

File content as of revision 0:f309f06aeec7:

#include "mbed.h"

DigitalOut myleds[] = {LED1, LED2, LED3, LED4};

void setMyLeds(bool arg0, bool arg1, bool arg2, bool arg3) {
    myleds[0] = arg0;
    myleds[1] = arg1;
    myleds[2] = arg2;
    myleds[3] = arg3;
}

int main() {
    for (int i = 15; i > 0; i--) {
        setMyLeds(i & 8, i & 4, i & 2, i & 1);
        wait(1.0);
    }

    for (bool on = false;; on = !on) {
        setMyLeds(on, on, on, on);
        wait(0.2);
    }
}