Envia valor de voltaje leido escalado por bluetooth.
Fork of VOLTIMETRO1 by
DebouncedIn.h@3:fc81cdd10312, 2015-04-24 (annotated)
- Committer:
- sagilar
- Date:
- Fri Apr 24 04:02:16 2015 +0000
- Revision:
- 3:fc81cdd10312
- Parent:
- 0:4676a90107ca
Programa que env?a por bluetooth el valor escalado del voltaje de entrada
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 |