arben sutter

Dependencies:   mbed

Fork of Oppgave7_1 by Sølibatgutt

Committer:
olemh88
Date:
Tue Sep 05 13:06:02 2017 +0000
Revision:
4:bfa6e8f625e2
Parent:
3:cdd8af1b6f39
Oppgave 2 E

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andreped 0:fe54cfab4520 1 #include "mbed.h"
andreped 0:fe54cfab4520 2
andreped 0:fe54cfab4520 3 BusOut teller(p21, p22, p23, p24, p25, p26);
olemh88 4:bfa6e8f625e2 4 DigitalIn bryter(p20);
olemh88 4:bfa6e8f625e2 5 DigitalIn bryter2(p19);
olemh88 4:bfa6e8f625e2 6 Serial pc (USBTX, USBRX);
andreped 0:fe54cfab4520 7
andreped 1:07b498c93e9a 8 int main()
andreped 1:07b498c93e9a 9 {
olemh88 4:bfa6e8f625e2 10 int x=0;
andreped 0:fe54cfab4520 11 while(1) {
olemh88 4:bfa6e8f625e2 12 pc.printf("%d",x);
olemh88 4:bfa6e8f625e2 13 if (bryter2 ==1) {
olemh88 4:bfa6e8f625e2 14 x=0;
olemh88 4:bfa6e8f625e2 15 }
olemh88 4:bfa6e8f625e2 16 teller =x;
olemh88 4:bfa6e8f625e2 17 if (bryter ==1) {
olemh88 4:bfa6e8f625e2 18
olemh88 4:bfa6e8f625e2 19 if ( x == 30) {
olemh88 4:bfa6e8f625e2 20 x = 0;
olemh88 4:bfa6e8f625e2 21 }
olemh88 4:bfa6e8f625e2 22 }
olemh88 4:bfa6e8f625e2 23 if ( x == 50) {
andreped 3:cdd8af1b6f39 24 x = 0;
olemh88 4:bfa6e8f625e2 25
andreped 1:07b498c93e9a 26 } else {
olemh88 4:bfa6e8f625e2 27
olemh88 4:bfa6e8f625e2 28 x = x+1;
andreped 2:6d50b444c4df 29 wait(0.25);
olemh88 4:bfa6e8f625e2 30
andreped 1:07b498c93e9a 31 }
andreped 0:fe54cfab4520 32 }
andreped 0:fe54cfab4520 33 }