usar este programa en monitoreo de voltaje con app inventor
Fork of serialtransmite1 by
DebouncedIn.h@2:cd043c95f930, 2015-10-05 (annotated)
- Committer:
- tony63
- Date:
- Mon Oct 05 01:46:02 2015 +0000
- Revision:
- 2:cd043c95f930
- Parent:
- 0:4676a90107ca
lee un voltaje y lo manda por serial al modulo bluetooth. la aplicacion es de app inventor VOLTAJE1
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 |