Pajić Enil Lejla Agić

Dependencies:   mbed

main.cpp

Committer:
tim008
Date:
2014-03-10
Revision:
0:03f37e705af1

File content as of revision 0:03f37e705af1:

#include "mbed.h"

BusOut KOL(dp16, dp15, dp17, dp18);
BusIn RED (dp9, dp10, dp11, dp13);
BusOut l (dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28);
DigitalOut e (dp14);
int Dugme ()
    {
        int Z[] = {1, 2, 4, 8};
        for (int a = 1; a < 5; ++a)
            {
                KOL = Z[a - 1];
                for (int b = 1; b < 5; ++b)
                    {
                        if (RED == Z[b-1])
                            return 1+ 4*(a-1) + (b-1);
                    }
                
            }
        return 0;
    }
int main() {
    int Z[] = {127, 191, 223, 239, 247, 251, 253, 254};
    e = 0;
    l = 1;
    e = 1;
    int x = 0;
    while(1) {
        e = 1;
        x = Dugme();
        e = 0;
        if (x > 0 && x < 13)
        {
            if (x >= 5 && x < 9) x--;
            if (x >= 9) x -= 2;
            
            l = Z[x-1];
        }
        wait (0.5);
    }
}