PRUEBA DE INGRESO ANALOGO EN APP INVENTOR CON FRDMKL25Z
Fork of serialtransmite1 by
/media/uploads/tony63/voltimetro.apk
DebouncedIn.h@2:8a0e46a84596, 2015-04-17 (annotated)
- Committer:
- tony63
- Date:
- Fri Apr 17 20:17:55 2015 +0000
- Revision:
- 2:8a0e46a84596
- Parent:
- 0:4676a90107ca
version corregida
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tony63 | 0:4676a90107ca | 1 | #include "mbed.h" |
tony63 | 0:4676a90107ca | 2 | |
tony63 | 0:4676a90107ca | 3 | class DebouncedIn { |
tony63 | 0:4676a90107ca | 4 | public: |
tony63 | 0:4676a90107ca | 5 | DebouncedIn(PinName in); |
tony63 | 0:4676a90107ca | 6 | |
tony63 | 0:4676a90107ca | 7 | int read (void); |
tony63 | 0:4676a90107ca | 8 | operator int(); |
tony63 | 0:4676a90107ca | 9 | |
tony63 | 0:4676a90107ca | 10 | int rising(void); |
tony63 | 0:4676a90107ca | 11 | int falling(void); |
tony63 | 0:4676a90107ca | 12 | int steady(void); |
tony63 | 0:4676a90107ca | 13 | |
tony63 | 0:4676a90107ca | 14 | private : |
tony63 | 0:4676a90107ca | 15 | // objects |
tony63 | 0:4676a90107ca | 16 | DigitalIn _in; |
tony63 | 0:4676a90107ca | 17 | Ticker _ticker; |
tony63 | 0:4676a90107ca | 18 | |
tony63 | 0:4676a90107ca | 19 | // function to take a sample, and update flags |
tony63 | 0:4676a90107ca | 20 | void _sample(void); |
tony63 | 0:4676a90107ca | 21 | |
tony63 | 0:4676a90107ca | 22 | // counters and flags |
tony63 | 0:4676a90107ca | 23 | int _samples; |
tony63 | 0:4676a90107ca | 24 | int _output; |
tony63 | 0:4676a90107ca | 25 | int _output_last; |
tony63 | 0:4676a90107ca | 26 | int _rising_flag; |
tony63 | 0:4676a90107ca | 27 | int _falling_flag; |
tony63 | 0:4676a90107ca | 28 | int _state_counter; |
tony63 | 0:4676a90107ca | 29 | |
tony63 | 0:4676a90107ca | 30 | }; |
tony63 | 0:4676a90107ca | 31 |