Interface to a standard tarco sensor. Measure the periode and the cal the speed
Tarco.h@3:6d3f2034e5f1, 2013-11-07 (annotated)
- Committer:
- gert_lauritsen
- Date:
- Thu Nov 07 12:02:47 2013 +0000
- Revision:
- 3:6d3f2034e5f1
- Parent:
- 2:c50da089786a
- Child:
- 4:35024179a736
Tarco sensor gives speed in hz and rpm
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 | Timer t; |
gert_lauritsen | 2:c50da089786a | 15 | public: |
gert_lauritsen | 2:c50da089786a | 16 | // ******************************************************************************** |
gert_lauritsen | 2:c50da089786a | 17 | // * Constructor |
gert_lauritsen | 2:c50da089786a | 18 | // * |
gert_lauritsen | 2:c50da089786a | 19 | // * @param flowsignal The pin which is connected to the flowsensor. |
gert_lauritsen | 2:c50da089786a | 20 | // ******************************************************************************** |
gert_lauritsen | 2:c50da089786a | 21 | Tarco(PinName tarcosignal); |
gert_lauritsen | 2:c50da089786a | 22 | |
gert_lauritsen | 3:6d3f2034e5f1 | 23 | // ******************************************************************************** |
gert_lauritsen | 3:6d3f2034e5f1 | 24 | // gives the tarco value in hz |
gert_lauritsen | 3:6d3f2034e5f1 | 25 | // ******************************************************************************** |
gert_lauritsen | 3:6d3f2034e5f1 | 26 | |
gert_lauritsen | 2:c50da089786a | 27 | float Speed(); |
gert_lauritsen | 3:6d3f2034e5f1 | 28 | // ******************************************************************************** |
gert_lauritsen | 3:6d3f2034e5f1 | 29 | // gives the tarco value in rotation pr min |
gert_lauritsen | 3:6d3f2034e5f1 | 30 | // ******************************************************************************** |
gert_lauritsen | 3:6d3f2034e5f1 | 31 | |
gert_lauritsen | 2:c50da089786a | 32 | float RPM(); |
gert_lauritsen | 2:c50da089786a | 33 | }; |
gert_lauritsen | 2:c50da089786a | 34 | |
gert_lauritsen | 2:c50da089786a | 35 | #endif |