Interface to a standard tarco sensor. Measure the periode and the cal the speed

Tarco.h

Committer:
gert_lauritsen
Date:
2016-04-15
Revision:
14:07d968decc76
Parent:
13:4b58c9730bc7

File content as of revision 14:07d968decc76:

#ifndef _Tarco_H
#define _Tarco_H

#include "mbed.h"
#define TarcoRunMean 50
#define PulsPrRotation 24
#define PulsTimeOut 200 //200ms
/************************************************************************************* 
*  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;
     int AdvPeriode; //running mean for tarco
    Timer t; //time for one rotation
    Ticker TimeOut;
    bool GettingPuls;
    float lastfrekvens;
    void Rotationtimer();   //measure tarco by dividing input frekvens with 24
    void TarcoTimeout();
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);
    
    /********************************************************************************
    * gives the tarco value in rotation pr min
    ********************************************************************************/

    float RPM();
    
};

#endif