Ensar Muratovic Maedeh Mousavi

Dependencies:   mbed

Revision:
0:fd92ba413aa6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Mar 20 16:24:04 2014 +0000
@@ -0,0 +1,53 @@
+#include "mbed.h"
+
+BusOut ledice(dp26, dp27, dp5, dp6, dp28, dp1, dp2);
+BusOut digit(dp23, dp24, dp25);
+BusOut tacka (dp4);
+
+int brojevi[10] = {0x40, 0x79, 0x24, 0x30, 0x19, 0x12, 0x02, 0x78, 0x00, 0x10};
+
+Timer brojac;
+
+void Stoperica (float vrijeme)
+{
+ int value[3] = {
+                (int) (vrijeme)/10,
+                (int) (vrijeme)%10,
+                (vrijeme -int(vrijeme))*10};
+                
+digit=3;
+ledice=brojevi[value[2]];
+wait_ms(2);
+
+digit=5;
+tacka=0;
+
+ledice=brojevi[value[1]];
+wait_ms(2);
+
+tacka=1;
+
+digit=6;
+ledice=brojevi[value[0]];
+ wait_ms(2);
+ 
+ digit=0;
+ }
+ 
+
+int main() {
+    
+    digit=0;
+    ledice=brojevi[0];
+    tacka=0;
+    wait(2);
+    brojac.start();
+    float vrijeme=0;
+    
+    while(1) {
+    
+    if(vrijeme<=12.3)
+        vrijeme=brojac.read();
+        Stoperica(vrijeme);
+    }
+}