Oppgave 2.1
Dependencies: mbed
Diff: main.cpp
- Revision:
- 4:bfa6e8f625e2
- Parent:
- 3:cdd8af1b6f39
diff -r cdd8af1b6f39 -r bfa6e8f625e2 main.cpp --- a/main.cpp Tue Sep 05 11:25:10 2017 +0000 +++ b/main.cpp Tue Sep 05 13:06:02 2017 +0000 @@ -1,17 +1,33 @@ #include "mbed.h" BusOut teller(p21, p22, p23, p24, p25, p26); +DigitalIn bryter(p20); +DigitalIn bryter2(p19); +Serial pc (USBTX, USBRX); int main() { + int x=0; while(1) { - int x = teller; - if ( x = 63) { + pc.printf("%d",x); + if (bryter2 ==1) { + x=0; + } + teller =x; + if (bryter ==1) { + + if ( x == 30) { + x = 0; + } + } + if ( x == 50) { x = 0; + } else { - x >= 63; - x = ++; + + x = x+1; wait(0.25); + } } }