
Džafić Faris Hasković Nedžad
main.cpp@0:76744b0a1fd1, 2014-03-13 (annotated)
- Committer:
- tim007
- Date:
- Thu Mar 13 17:04:51 2014 +0000
- Revision:
- 0:76744b0a1fd1
Lv2 - PAI - Grupa 6 - Tim007
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tim007 | 0:76744b0a1fd1 | 1 | #include "mbed.h" |
tim007 | 0:76744b0a1fd1 | 2 | |
tim007 | 0:76744b0a1fd1 | 3 | BusOut ledice(dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28); |
tim007 | 0:76744b0a1fd1 | 4 | DigitalOut myled(LED1); |
tim007 | 0:76744b0a1fd1 | 5 | DigitalOut enable(dp14); |
tim007 | 0:76744b0a1fd1 | 6 | DigitalOut red[4] = {dp16, dp15, dp17, dp18}; |
tim007 | 0:76744b0a1fd1 | 7 | DigitalIn kolona[4] = {dp9, dp10, dp11, dp13}; |
tim007 | 0:76744b0a1fd1 | 8 | |
tim007 | 0:76744b0a1fd1 | 9 | char matrica[4][4] = {{'1','2','3','A'}, {'4','5','6','B'}, {'7','8','9','C'}, {'*','0','#','D'}}; |
tim007 | 0:76744b0a1fd1 | 10 | |
tim007 | 0:76744b0a1fd1 | 11 | char dajOznaku(int red) { |
tim007 | 0:76744b0a1fd1 | 12 | for(int i=0; i<4; i++) if(kolona[i] == 1) return matrica[i][znak-1]; |
tim007 | 0:76744b0a1fd1 | 13 | return 'x'; |
tim007 | 0:76744b0a1fd1 | 14 | } |
tim007 | 0:76744b0a1fd1 | 15 | |
tim007 | 0:76744b0a1fd1 | 16 | int main() { |
tim007 | 0:76744b0a1fd1 | 17 | enable = 0; |
tim007 | 0:76744b0a1fd1 | 18 | while(1) { |
tim007 | 0:76744b0a1fd1 | 19 | char k('x'); |
tim007 | 0:76744b0a1fd1 | 20 | for(int i(0); i<4; i++) |
tim007 | 0:76744b0a1fd1 | 21 | if(k>='0' && k<='9') ledice = k-'0'; |
tim007 | 0:76744b0a1fd1 | 22 | } |
tim007 | 0:76744b0a1fd1 | 23 | } |