Oppgave 6.2

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Smashftw
Date:
Tue Oct 03 13:17:49 2017 +0000
Commit message:
Oppgave 62

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 c3a834e9ee10 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 03 13:17:49 2017 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+
+BusOut ledNS (p7, p6, p5); // Grønn, Gul, Rød
+BusOut ledOV (p10, p9, p8); // Grønn, Gul, Rød
+DigitalIn bryter(p20);
+
+
+int lysNS[8] = {1, 1, 1, 3, 4, 2, 1, 1};
+int lysOV[8] = {4, 2, 1, 1, 1, 1 ,1, 3};
+int ventetid[8] = {5000, 2000, 1000, 500, 5000, 2000, 1000, 500};
+int main()
+{
+    while(1) {
+        for (int i=0; i<8; i++) {
+            if (bryter==1) {
+                ledNS=lysNS [5];
+                ledOV=lysOV [1];
+                wait(0.5);
+                ledNS=0;
+                ledOV=0;
+                wait(0.5);
+
+            } else {
+
+                ledNS = lysNS[i];
+                ledOV = lysOV[i];
+                wait_ms (ventetid[i]);
+            }
+
+        }
+    }
+}
+
diff -r 000000000000 -r c3a834e9ee10 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 03 13:17:49 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/235179ab3f27
\ No newline at end of file