Laboratorijska vjezba 1 Zadatak 3 Adam Stanic , Alen Sjenicaku

Dependencies:   mbed

Revision:
0:5a68fc8a93eb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 07 21:44:54 2016 +0000
@@ -0,0 +1,51 @@
+#include "mbed.h"
+#define dp23 P0_0
+ 
+ 
+ 
+ 
+DigitalOut enable(dp14);
+ 
+ 
+ 
+BusOut bus  (dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28);
+ 
+DigitalIn ulaz(dp1);
+ 
+ 
+int main() {
+    enable=0;
+   
+    while(1)
+    {
+   
+    bool istina=false;
+    bus=0;
+   
+    for(int i=0;i<128;i++)
+        {
+            bus=i;
+            wait(1);
+           
+            if(ulaz==1)
+                {
+                    int j=i;
+                    for(j=i;j>0;j--)
+                    {
+                        bus=j;
+                        wait(1);
+                        if(j==0)
+                            {
+                                istina=true;
+                                i=0;
+                                }
+                    }
+                    if(istina) break;
+                   
+                }
+                if(istina) break;
+ 
+           
+        }
+    }
+    }
\ No newline at end of file