Mesud Klisura

Dependencies:   mbed

main.cpp

Committer:
tim004
Date:
2014-03-13
Revision:
0:02ce06f2f4a3

File content as of revision 0:02ce06f2f4a3:

#include "mbed.h"

BusOut led(dp23,dp24,dp25,dp26,dp27,dp5,dp6,dp28);
DigitalOut enable(dp14);

BusOut red(dp16,dp15,dp17,dp18);
BusIn kolona(dp9,dp10,dp11,dp13);


int Pressed(BusIn kolona, BusOut red)
{
   int A=10;
   int B=11;
   int C=12;
   int D=13;
   int zvijezda =20;
   int resetka =40;
   
   red=8;
   if(kolona==8) return A;
   else if (kolona==4) return 3;
   else if (kolona==2) return 2;
   else if (kolona==1) return 1;
   red=0;
   
   red=4;
   if(kolona==8) return B;
   else if (kolona==4) return 6;
   else if (kolona==2) return 5;
   else if (kolona==1) return 4; 
   red=0;

   red=2;
   if(kolona==8) return C;
   else if (kolona==4) return 9;
   else if (kolona==2) return 8;
   else if (kolona==1) return 7;
   red=0;
   
   red=1;
   if(kolona==8) return D;
   else if (kolona==4) return zvijezda;
   else if (kolona==2) return 0;
   else if (kolona==1) return resetka;   
   red=0;

   return 0;  
}




int main() {
    
  enable = 0;
  led = 0;
        int pritisnuto=0;Pressed(kolona,red);
  while(1) 
  {
    pritisnuto=Pressed(kolona,red);
    if(pritisnuto==10)
    led= 129;
    else led=pritisnuto;
    wait(1);
    
  }
}