Esempio di latenza di un Interrupt

Dependencies:   mbed

main.cpp

Committer:
Mattinico
Date:
2016-11-06
Revision:
0:046cbaef2d68

File content as of revision 0:046cbaef2d68:

 /* Program Example 2: Tests interrupt latency. External input causes interrupt, which
 pulses external LED.
*/
 #include "mbed.h"
 InterruptIn squarewave(D2); //Connect input square wave here
 DigitalOut out(D3);
 DigitalOut out2(D4);
 void pulse() //ISR sets external led high for fixed duration
 {
     out = 1;
     wait_us(50);
     out = 0;
 }
 int main()
 {
     squarewave.rise(&pulse); // attach the address of the pulse function to
     // the rising edge
     while(1) { // interrupt will occur within this endless loop
         Out2=!out2;
         wait_ms(25);
     }
 }