test

Dependencies:   mbed

Fork of Pushbutton_BadBounce_Interrupt by jim hamblen

main.cpp

Committer:
takahiroabe
Date:
2018-09-14
Revision:
2:4995292ee59f
Parent:
1:6582c095e8d1

File content as of revision 2:4995292ee59f:

#include "mbed.h"

DigitalOut myled(LED1);
InterruptIn pb(p8,PullNone);
Serial pc(USBTX, USBRX);



// Global count variable
int volatile count=0;

// pb Interrupt routine - is interrupt activated by a falling edge of pb input
void pb_hit_interrupt (void) {
    count++;
}

int main() {
    wait(0.01);
    pc.printf("Hello Deboucing \r\n");
    
    pb.fall(&pb_hit_interrupt);
    
    while (1) {
        myled = !myled;
        wait(0.5);
    }
}