tim007 tim007
/
LV8-Grupa6-Tim007-zad2
Armin Klačar Josip Kvesić
main.cpp
- Committer:
- tim007
- Date:
- 2014-05-08
- Revision:
- 0:93a79d0fe805
File content as of revision 0:93a79d0fe805:
#include "mbed.h" Serial pc (USBTX, USBRX); BusIn columns(dp9,dp10,dp11,dp13); BusOut rows(dp2, dp1, dp28, dp6); Timer deb; char button(){ char character[16] = {'1','2','3','A','4','5','6','B','7','8','9','C','*','0','#','D'}; for(int i = 0; i <= 3; i++) { rows = (1 << i); for(int j = 0; j <= 3; j++) if(columns == (1 << j)){ if (deb.read_ms()<400) return NULL; deb.reset(); return character[ i * 4 + j ]; } } return NULL; } void display(){ char c = button(); if (c==NULL) return; if (c=='*') pc.putc ('\n'); else pc.putc (c); } int main() { rows=0; deb.start(); while(1){display();} }