Interface to a standard tarco sensor. Measure the periode and the cal the speed
Tarco.h
- Committer:
- gert_lauritsen
- Date:
- 2016-02-28
- Revision:
- 12:9269bd188bfa
- Parent:
- 11:284b87a84cdd
- Child:
- 13:4b58c9730bc7
File content as of revision 12:9269bd188bfa:
#ifndef _Tarco_H #define _Tarco_H #include "mbed.h" #define TarcoRunMean 50 #define PulsPrRotation 23 #define HirthMode 2 #define SwitchAuto 1 #define RunMeanSwitchAuto 0 //typedef void (*callback_type)(int); /************************************************************************************* * Tarco sensor on the SwitchAuto * Have 2 mode to measure the rotation * @param mode * Mode 0 Prescale * Mode 1 Runing mean *************************************************************************************/ class Tarco { private: InterruptIn _tarcosensor; // callback_type callback; int AdvPeriode[TarcoRunMean]; //running mean for tarco Timer t; //time for one rotation char tarcomode; float lastfrekvens; float advfrekvens; int lastperiode; void Hird(); void RunMeanMeasure(); //Measure the tarco from a one puls /rotation source void Rotationtimer(); //measure tarco by dividing input frekvens with 24 public: /******************************************************************************** * Constructor * @param flowsignal The pin which is connected to the flowsensor. * * change the mode of the tarco * 0: Standard Prescale to one measure pr rotation * 1: Running mean ********************************************************************************/ Tarco(PinName tarcosignal,char mode); /******************************************************************************** * gives the tarco value in hz ********************************************************************************/ float Speed(); /******************************************************************************** * gives the tarco value in rotation pr min ********************************************************************************/ float RPM(); }; #endif