![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Oppgave6.3
Dependencies: mbed
Revision 0:e6f472233de6, committed 2017-10-03
- Comitter:
- Smashftw
- Date:
- Tue Oct 03 14:22:25 2017 +0000
- Commit message:
- Oppgave63
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 03 14:22:25 2017 +0000 @@ -0,0 +1,47 @@ +#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); +Ticker t1; +volatile int T2; +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}; +void f (void); + +int main() +{ + while(1) { + t1.attach (&f,1); + if (T2<20) { + + for (int i=0; i<8; i++) { + + ledNS = lysNS[i]; + ledOV = lysOV[i]; + wait_ms (ventetid[i]); + } + } else if (T2 >= 20) { + + ledNS=lysNS [5]; + ledOV=lysOV [1]; + wait(0.5); + ledNS=0; + ledOV=0; + wait(0.5); + } + } +} +void f (void) +{ + if ( T2<40) { + T2++; + } else T2 = 0; + + + + + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 03 14:22:25 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/235179ab3f27 \ No newline at end of file