oppg2

Dependencies:   mbed

Fork of LAB07_Oppgave2 by EL-POM1001

Committer:
eivindd24
Date:
Sat Dec 10 10:25:22 2016 +0000
Revision:
3:676daabf1a54
Parent:
2:a27126b6128e
ok

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rlanghbv 0:78adfca8ca69 1 #include "mbed.h"
rlanghbv 0:78adfca8ca69 2
rlanghbv 1:2e42c8846b90 3 InterruptIn knapp(PB_3);
rlanghbv 1:2e42c8846b90 4 BusOut leds(PA_9,PC_7,PB_6,PA_7,PA_6,PA_5,PB_5,PB_4);
rlanghbv 1:2e42c8846b90 5 static int teller=0;
rlanghbv 2:a27126b6128e 6 Timeout timeOutIrq;
rlanghbv 1:2e42c8846b90 7
rlanghbv 2:a27126b6128e 8 void enableKnappeTrykk(){
rlanghbv 2:a27126b6128e 9 knapp.enable_irq();
rlanghbv 2:a27126b6128e 10 }
rlanghbv 0:78adfca8ca69 11
rlanghbv 1:2e42c8846b90 12 void knappTrykket(){
rlanghbv 2:a27126b6128e 13 knapp.disable_irq();
eivindd24 3:676daabf1a54 14 timeOutIrq.attach(&enableKnappeTrykk,.3);
rlanghbv 1:2e42c8846b90 15 teller=teller+1;
rlanghbv 1:2e42c8846b90 16 leds=~teller;
rlanghbv 0:78adfca8ca69 17 }
rlanghbv 0:78adfca8ca69 18
rlanghbv 1:2e42c8846b90 19 int main(){
rlanghbv 1:2e42c8846b90 20 knapp.fall(&knappTrykket);
rlanghbv 1:2e42c8846b90 21 leds=~0;
rlanghbv 1:2e42c8846b90 22 while (true) { wait(1); }
rlanghbv 0:78adfca8ca69 23 }