s

Dependencies:   mbed

Fork of LAB07_Oppgave2 by EL-POM1001

Committer:
rlanghbv
Date:
Sun Sep 20 14:30:57 2015 +0000
Revision:
0:78adfca8ca69
Child:
1:2e42c8846b90
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rlanghbv 0:78adfca8ca69 1 #include "mbed.h"
rlanghbv 0:78adfca8ca69 2
rlanghbv 0:78adfca8ca69 3
rlanghbv 0:78adfca8ca69 4 InterruptIn TachInput(PB_3);
rlanghbv 0:78adfca8ca69 5
rlanghbv 0:78adfca8ca69 6 BusOut Leds(PA_9,PC_7,PB_6,PA_7,PA_6,PA_5,PB_5,PB_4);
rlanghbv 0:78adfca8ca69 7 static int teller=0;
rlanghbv 0:78adfca8ca69 8
rlanghbv 0:78adfca8ca69 9 void TachSensed()
rlanghbv 0:78adfca8ca69 10 { teller=teller+1;
rlanghbv 0:78adfca8ca69 11 }
rlanghbv 0:78adfca8ca69 12
rlanghbv 0:78adfca8ca69 13 int main()
rlanghbv 0:78adfca8ca69 14 {
rlanghbv 0:78adfca8ca69 15 TachInput.fall(&TachSensed);
rlanghbv 0:78adfca8ca69 16
rlanghbv 0:78adfca8ca69 17 while (true)
rlanghbv 0:78adfca8ca69 18 { teller=0;
rlanghbv 0:78adfca8ca69 19 TachInput.enable_irq();
rlanghbv 0:78adfca8ca69 20 wait_ms(1000);
rlanghbv 0:78adfca8ca69 21 TachInput.disable_irq();
rlanghbv 0:78adfca8ca69 22
rlanghbv 0:78adfca8ca69 23 Leds=~ ((1<< teller) -1);
rlanghbv 0:78adfca8ca69 24 }
rlanghbv 0:78adfca8ca69 25 }