NTERUPCIONES POR ENTRADA DIGITAL DETECTA FLANCOS Y GENERA INTERUPCIONES este programa verifica que en una frdmkl25z funcionan bien las interupciones por entradas digitales
main.cpp@0:2ae2fd3ac8a4, 2016-04-23 (annotated)
- Committer:
- tony63
- Date:
- Sat Apr 23 06:47:18 2016 +0000
- Revision:
- 0:2ae2fd3ac8a4
INTERRUPCIONES POR ENTRADA DIGITAL; DETECTA FLANCOS Y GENERA INTERUPCIONES; este programa verifica que en una frdmkl25z; funcionan bien las interupciones por entradas digitales
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tony63 | 0:2ae2fd3ac8a4 | 1 | /* |
tony63 | 0:2ae2fd3ac8a4 | 2 | INTERUPCIONES POR ENTRADA DIGITAL |
tony63 | 0:2ae2fd3ac8a4 | 3 | DETECTA FLANCOS Y GENERA INTERUPCIONES |
tony63 | 0:2ae2fd3ac8a4 | 4 | este programa verifica que en una frdmkl25z |
tony63 | 0:2ae2fd3ac8a4 | 5 | funcionan bien las interupciones por entradas digitales |
tony63 | 0:2ae2fd3ac8a4 | 6 | */ |
tony63 | 0:2ae2fd3ac8a4 | 7 | #include "mbed.h" |
tony63 | 0:2ae2fd3ac8a4 | 8 | |
tony63 | 0:2ae2fd3ac8a4 | 9 | DigitalOut LedRojo(LED1); |
tony63 | 0:2ae2fd3ac8a4 | 10 | DigitalOut LedVerde(LED2); |
tony63 | 0:2ae2fd3ac8a4 | 11 | InterruptIn sw2(PTA13); |
tony63 | 0:2ae2fd3ac8a4 | 12 | Timer t; |
tony63 | 0:2ae2fd3ac8a4 | 13 | void sw2_release(void) |
tony63 | 0:2ae2fd3ac8a4 | 14 | { |
tony63 | 0:2ae2fd3ac8a4 | 15 | LedVerde=0; |
tony63 | 0:2ae2fd3ac8a4 | 16 | LedRojo=1; |
tony63 | 0:2ae2fd3ac8a4 | 17 | } |
tony63 | 0:2ae2fd3ac8a4 | 18 | |
tony63 | 0:2ae2fd3ac8a4 | 19 | void sw2_pull(void) |
tony63 | 0:2ae2fd3ac8a4 | 20 | { |
tony63 | 0:2ae2fd3ac8a4 | 21 | LedVerde=1; |
tony63 | 0:2ae2fd3ac8a4 | 22 | LedRojo=0; |
tony63 | 0:2ae2fd3ac8a4 | 23 | } |
tony63 | 0:2ae2fd3ac8a4 | 24 | |
tony63 | 0:2ae2fd3ac8a4 | 25 | |
tony63 | 0:2ae2fd3ac8a4 | 26 | int main() |
tony63 | 0:2ae2fd3ac8a4 | 27 | { |
tony63 | 0:2ae2fd3ac8a4 | 28 | sw2.rise(&sw2_release); |
tony63 | 0:2ae2fd3ac8a4 | 29 | sw2.fall(&sw2_pull); |
tony63 | 0:2ae2fd3ac8a4 | 30 | |
tony63 | 0:2ae2fd3ac8a4 | 31 | while (true) { |
tony63 | 0:2ae2fd3ac8a4 | 32 | } |
tony63 | 0:2ae2fd3ac8a4 | 33 | } |
tony63 | 0:2ae2fd3ac8a4 | 34 |