LED and button system

Dependencies:   mbed

Fork of LED by CHANG rozen

main.cpp

Committer:
e58136782000
Date:
2017-10-20
Revision:
3:684d085cd132
Parent:
2:7bb4b5066464

File content as of revision 3:684d085cd132:

#include "mbed.h"

DigitalOut led1(D4);
DigitalOut led2(D5);
DigitalOut led3(D6);
DigitalIn  button(D7);
void LED_Blinkly(DigitalOut led1,DigitalOut led2,DigitalOut led3);
// main() runs in its own thread in the OS
int main() 
{
    while(1)
    {

        if(button == true)
        {
           led1 =! led1;
           wait(0.5);
            led2 =! led2;
            wait(0.5);
            led3 =! led3;
           wait(0.5);    
        }
        else
        {
            led1 = false;
            led2 = false;
            led3 = false;
        }
    }
}