/////////////////////////////// // // prog_practice_8 project // // 9/26/22 - tj // // practice with input pin interrupts // /////////////////////////////// #include "mbed.h" #include #define T_WAIT 200000 // create a global variable to use in ISR (allowed exception) // note initialization - could get an interrupt before we get to // initialization inside main int cnt = 0; // prototype for ISR Fn. must be void, void void my_int_isr(void); void splash(void); int main(void){ setbuf(stdout, NULL); // splash splash(); // create interrupt object InterruptIn my_pin_int(D4); // attach isr to my object my_pin_int.fall(&my_int_isr); // infinite loop to wait for interrupts while(1){ printf("current cnt = %-8i\r", cnt); cnt++; wait_us(T_WAIT); }// end while return 0; }// end main void splash(void){ printf("\n\n my interrupt program\n\n"); return; }// end splash; void my_int_isr(void){ // cnt++; cnt=0; return; }// end my_int_isr