Beganovic Benjamin Mustafic Faruk

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
tim008
Date:
Mon Mar 10 09:59:21 2014 +0000
Commit message:
lab2_grupa2_tim8

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 84e203ae3518 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 10 09:59:21 2014 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+
+#define WAIT_TIME 0.05
+#define MAX_COUNT 255
+
+BusOut my_ledice(dp23, dp24, dp25, dp26,
+        dp27, dp5, dp6, dp28);
+
+DigitalIn taster1(dp1), taster2(dp2);
+
+        
+int main() {
+        
+    DigitalOut enable(dp14);
+    enable = 0;
+    
+    my_ledice = 0;
+    
+    int state1 = 0, state2 = 0;
+    
+    while(true) {
+        if(!taster1 && state1 == 1) {
+            my_ledice = (my_ledice + 1) % MAX_COUNT;
+        }        
+        state1 = taster1;
+        
+        if(!taster2 && state2 == 1) {
+            my_ledice = 
+                (my_ledice == 0) ? MAX_COUNT : (my_ledice - 1) % MAX_COUNT;
+        }        
+        
+        state1 = taster1;
+        state2 = taster2;
+        
+        wait(WAIT_TIME);
+    }
+    
+    return 0;
+}
diff -r 000000000000 -r 84e203ae3518 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Mar 10 09:59:21 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1
\ No newline at end of file