![](/media/cache/profiles/c4661f6669f5f35823f39acb6d6be725.jpg.50x50_q85.jpg)
2 ports read ang
Fork of VOLTIMETRO1 by
DebouncedIn.h@0:4676a90107ca, 2015-04-14 (annotated)
- Committer:
- tony63
- Date:
- Tue Apr 14 02:05:54 2015 +0000
- Revision:
- 0:4676a90107ca
Programa que transmite cadenas, util para verificar si APPINVENTOR recibe cadenas, tres entradas digitales suicheadas controlan en modo toggle, tres colores en la pantalla.
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 |