Irma Jakić Tarik Demirović

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
tim003
Date:
Mon Mar 10 09:03:52 2014 +0000
Commit message:
LV1 - PAI - Grupa1 - Tim003

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
diff -r 000000000000 -r 56168fad0933 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 10 09:03:52 2014 +0000
@@ -0,0 +1,137 @@
+#include "mbed.h"
+
+DigitalIn Ulaz1(dp16);
+DigitalIn Ulaz2(dp15);
+DigitalIn Ulaz3(dp17);
+DigitalIn Ulaz4(dp18);
+DigitalOut Izlaz1(dp9);
+DigitalOut Izlaz2(dp10);
+DigitalOut Izlaz3(dp11);
+DigitalOut Izlaz4(dp13);
+
+BusOut leds(dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28);
+DigitalOut enable(dp14);
+
+
+int kojiJePritisnut()
+{
+    Izlaz1 = 1;
+    Izlaz2 = 0;
+    Izlaz3 = 0;
+    Izlaz4 = 0;
+    if(Ulaz1){
+            return 1;
+        }
+    if(Ulaz2){
+            return 4;
+        }
+    if(Ulaz3){
+            return 7;
+        }
+    if(Ulaz4){
+            return 10;
+        }
+        
+    Izlaz1 = 0;
+    Izlaz2 = 1;
+    Izlaz3 = 0;
+    Izlaz4 = 0;
+    if(Ulaz1){
+            return 2;
+        }
+    if(Ulaz2){
+            return 5;
+        }
+    if(Ulaz3){
+            return 8;
+        }
+    if(Ulaz4){
+            return 0;
+        }
+    
+    Izlaz1 = 0;
+    Izlaz2 = 0;
+    Izlaz3 = 1;
+    Izlaz4 = 0;
+    if(Ulaz1){
+            return 3;
+        }
+    if(Ulaz2){
+            return 6;
+        }
+    if(Ulaz3){
+            return 9;
+        }
+    if(Ulaz4){
+            return 11;
+        }
+    
+    Izlaz1 = 0;
+    Izlaz2 = 0;
+    Izlaz3 = 0;
+    Izlaz4 = 1;
+    if(Ulaz1){
+            return 12;
+        }
+    if(Ulaz2){
+            return 13;
+        }
+    if(Ulaz3){
+            return 14;
+        }
+    if(Ulaz4){
+            return 15;
+        }
+    
+    return 16;
+}
+        
+            
+int main() {
+    enable = 0;
+    leds = 255;
+    int broj;
+    while(1)
+    {
+        broj = kojiJePritisnut();
+        if(broj == 1)
+        {
+            leds = 254;
+        }
+        
+        if(broj == 2)
+        {
+            leds = 253;
+        }
+        
+        if(broj == 3)
+        {
+            leds = 251;
+        }
+        
+        if(broj == 4)
+        {
+            leds = 247;
+        }
+        
+        if(broj == 5)
+        {
+            leds = 239;
+        }
+        
+        if(broj == 6)
+        {
+            leds = 223;
+        }
+        
+        if(broj == 7)
+        {
+            leds = 191;
+        }
+        
+        if(broj == 8)
+        {
+            leds = 127;
+        }
+    }
+}
diff -r 000000000000 -r 56168fad0933 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Mar 10 09:03:52 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1
\ No newline at end of file