Eivind Dammen
/
LAB07_Oppgave2
oppg2
Fork of LAB07_Oppgave2 by
main.cpp@2:a27126b6128e, 2015-10-15 (annotated)
- Committer:
- rlanghbv
- Date:
- Thu Oct 15 08:38:07 2015 +0000
- Revision:
- 2:a27126b6128e
- Parent:
- 1:2e42c8846b90
- Child:
- 3:676daabf1a54
Error fix
Who changed what in which revision?
User | Revision | Line number | New 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(); |
rlanghbv | 2:a27126b6128e | 14 | timeOutIrq.attach(&enableKnappeTrykk,.1); |
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 | } |