Gustavo Ramirez
/
gsmrecibe1
este programa acciona un led con un mensaje de texto "Led verde" y apaga con "Lgeverde" el led azul
DebouncedIn.h@1:f21dc295f75c, 2017-04-28 (annotated)
- Committer:
- tony63
- Date:
- Fri Apr 28 15:46:29 2017 +0000
- Revision:
- 1:f21dc295f75c
- Parent:
- 0:f9ce3b274d95
versi?n corregida abril 28/2017
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tony63 | 0:f9ce3b274d95 | 1 | #include "mbed.h" |
tony63 | 0:f9ce3b274d95 | 2 | |
tony63 | 0:f9ce3b274d95 | 3 | class DebouncedIn { |
tony63 | 0:f9ce3b274d95 | 4 | public: |
tony63 | 0:f9ce3b274d95 | 5 | DebouncedIn(PinName in); |
tony63 | 0:f9ce3b274d95 | 6 | |
tony63 | 0:f9ce3b274d95 | 7 | int read (void); |
tony63 | 0:f9ce3b274d95 | 8 | operator int(); |
tony63 | 0:f9ce3b274d95 | 9 | |
tony63 | 0:f9ce3b274d95 | 10 | int rising(void); |
tony63 | 0:f9ce3b274d95 | 11 | int falling(void); |
tony63 | 0:f9ce3b274d95 | 12 | int steady(void); |
tony63 | 0:f9ce3b274d95 | 13 | |
tony63 | 0:f9ce3b274d95 | 14 | private : |
tony63 | 0:f9ce3b274d95 | 15 | // objects |
tony63 | 0:f9ce3b274d95 | 16 | DigitalIn _in; |
tony63 | 0:f9ce3b274d95 | 17 | Ticker _ticker; |
tony63 | 0:f9ce3b274d95 | 18 | |
tony63 | 0:f9ce3b274d95 | 19 | // function to take a sample, and update flags |
tony63 | 0:f9ce3b274d95 | 20 | void _sample(void); |
tony63 | 0:f9ce3b274d95 | 21 | |
tony63 | 0:f9ce3b274d95 | 22 | // counters and flags |
tony63 | 0:f9ce3b274d95 | 23 | int _samples; |
tony63 | 0:f9ce3b274d95 | 24 | int _output; |
tony63 | 0:f9ce3b274d95 | 25 | int _output_last; |
tony63 | 0:f9ce3b274d95 | 26 | int _rising_flag; |
tony63 | 0:f9ce3b274d95 | 27 | int _falling_flag; |
tony63 | 0:f9ce3b274d95 | 28 | int _state_counter; |
tony63 | 0:f9ce3b274d95 | 29 | |
tony63 | 0:f9ce3b274d95 | 30 | }; |
tony63 | 0:f9ce3b274d95 | 31 |