Interrupt

Dependencies:   mbed

main.cpp

Committer:
fkgjh
Date:
2015-10-15
Revision:
0:6643d1c94bd0

File content as of revision 0:6643d1c94bd0:

#include "mbed.h"

InterruptIn SW7(PB_3);
InterruptIn SW6(PA_10);

Timer timer;
static double tidSek;

void startKlokke()
{
    timer.reset();
    timer.start();
}

void stopKlokke()
{
    timer.stop();
    tidSek=timer.read_ms()/1000.0;
    printf("tid %.3f sek\r\n", tidSek);
}

int main() 
{   
    SW7.fall(&startKlokke);
    SW6.fall(&stopKlokke);
    
    while (true) 
    {   
        wait_ms(200); 
    }
}