Interface to a standard tarco sensor. Measure the periode and the cal the speed
Tarco.h@2:c50da089786a, 2013-11-07 (annotated)
- Committer:
- gert_lauritsen
- Date:
- Thu Nov 07 09:23:27 2013 +0000
- Revision:
- 2:c50da089786a
- Child:
- 3:6d3f2034e5f1
tarco meter
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gert_lauritsen | 2:c50da089786a | 1 | #include "mbed.h" |
gert_lauritsen | 2:c50da089786a | 2 | |
gert_lauritsen | 2:c50da089786a | 3 | #ifndef _Tarco_H |
gert_lauritsen | 2:c50da089786a | 4 | #define _Tarco_H |
gert_lauritsen | 2:c50da089786a | 5 | |
gert_lauritsen | 2:c50da089786a | 6 | |
gert_lauritsen | 2:c50da089786a | 7 | class Tarco { |
gert_lauritsen | 2:c50da089786a | 8 | |
gert_lauritsen | 2:c50da089786a | 9 | private: |
gert_lauritsen | 2:c50da089786a | 10 | InterruptIn _tarcosensor; |
gert_lauritsen | 2:c50da089786a | 11 | void click(); |
gert_lauritsen | 2:c50da089786a | 12 | uint32_t PrevPulses; |
gert_lauritsen | 2:c50da089786a | 13 | int AdvPeriode; |
gert_lauritsen | 2:c50da089786a | 14 | int NAdv; |
gert_lauritsen | 2:c50da089786a | 15 | float AdvSpeed; |
gert_lauritsen | 2:c50da089786a | 16 | int NAdvSpeed; |
gert_lauritsen | 2:c50da089786a | 17 | Timer t; |
gert_lauritsen | 2:c50da089786a | 18 | public: |
gert_lauritsen | 2:c50da089786a | 19 | // ******************************************************************************** |
gert_lauritsen | 2:c50da089786a | 20 | // * Constructor |
gert_lauritsen | 2:c50da089786a | 21 | // * |
gert_lauritsen | 2:c50da089786a | 22 | // * @param flowsignal The pin which is connected to the flowsensor. |
gert_lauritsen | 2:c50da089786a | 23 | // ******************************************************************************** |
gert_lauritsen | 2:c50da089786a | 24 | Tarco(PinName tarcosignal); |
gert_lauritsen | 2:c50da089786a | 25 | |
gert_lauritsen | 2:c50da089786a | 26 | uint32_t Puls; |
gert_lauritsen | 2:c50da089786a | 27 | float Speed(); |
gert_lauritsen | 2:c50da089786a | 28 | float RPM(); |
gert_lauritsen | 2:c50da089786a | 29 | }; |
gert_lauritsen | 2:c50da089786a | 30 | |
gert_lauritsen | 2:c50da089786a | 31 | #endif |