tim007 tim007
/
LV8_PAI_Tim007_Z2
Jarebica Azra Djenasevic Emir
Revision 0:286e4dcde50c, committed 2014-05-12
- Comitter:
- tim007
- Date:
- Mon May 12 07:07:11 2014 +0000
- Commit message:
- LV8-Grupa1-PAI-Z2
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon May 12 07:07:11 2014 +0000 @@ -0,0 +1,57 @@ +#include "mbed.h" + +Serial pc(USBTX, USBRX); +DigitalIn kolone[4]={dp2, dp1, dp28, dp6}; +DigitalOut redovi[4]={dp9, dp10, dp11, dp13}; +Ticker ticker; + +char taster(){ + char a='F'; + for(int i=0; i<4; i++){ + redovi[i]=1; + if(i==0){ + if(kolone[0]==1) a='1'; + if(kolone[1]==1) a='4'; + if(kolone[2]==1) a='7'; + if(kolone[3]==1) a='*'; + } + else if(i==1){ + if(kolone[0]==1) a='2'; + if(kolone[1]==1) a='5'; + if(kolone[2]==1) a='8'; + if(kolone[3]==1) a='0'; + } + else if(i==2){ + if(kolone[0]==1) a='3'; + if(kolone[1]==1) a='6'; + if(kolone[2]==1) a='9'; + if(kolone[3]==1) a='#'; + } + else if(i==3){ + if(kolone[0]==1) a='A'; + if(kolone[1]==1) a='B'; + if(kolone[2]==1) a='C'; + if(kolone[3]==1) a='D'; + } + redovi[i]=0; + } + return a; +} + +void prikaz() +{ + char c=taster(); + if(c==0) + return; + if(c!='*' && c!='F') + pc.putc(c); + else if(c=='*') + pc.putc('\n'); +} +int main() { + ticker.attach(prikaz,0.3); + + while(1) { + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon May 12 07:07:11 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file