Stop light for pedestrians

Dependencies:   mbed

main.cpp

Committer:
gcarmonar
Date:
2014-11-24
Revision:
0:12ef4957674a

File content as of revision 0:12ef4957674a:

#include "mbed.h"

DigitalOut c_verde(D0);
DigitalOut c_amarillo(D1);
DigitalOut c_rojo(D2);
DigitalOut p_rojo(D3);
DigitalOut p_verde(D4);
DigitalIn boton(D5);

int main()
{
    while (true) {
        c_verde = 1;
        p_rojo = 1;
        if (boton){
            for (int i = 0; i < 3; i++){
                c_verde = 1;
                wait(0.5);
                c_verde = 0;
                wait(0.5);
            }
            c_amarillo = 1;
            wait(1);
            c_amarillo = 0;
            c_rojo = 1;
            p_verde = 1;
            p_rojo = 0;
            wait(6);
        } // if
    } // while
} // main