tim007 tim007 / Mbed 2 deprecated LV8-Grupa6-Tim007-zad2

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
tim007
Date:
Thu May 08 15:23:44 2014 +0000
Commit message:
LV8-PAI-Grupa6-Tim007

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	Thu May 08 15:23:44 2014 +0000
@@ -0,0 +1,32 @@
+#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();}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 08 15:23:44 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file