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

Tarco.h

Committer:
gert_lauritsen
Date:
2013-11-19
Revision:
4:35024179a736
Parent:
3:6d3f2034e5f1
Child:
5:451dd1189b0f

File content as of revision 4:35024179a736:

#include "mbed.h"

#ifndef _Tarco_H
#define _Tarco_H


class Tarco {

private:
    InterruptIn _tarcosensor;
    void click(); //Measure the tarco from a one puls /rotation source
    void fsk();   //measure tarco from a fsk source
    int p1,p2;
    int AdvPeriode;
    Timer t; //time for one rotation
    Timer fsktime; //time between fsk pulse
    int pulsvariation, lastpuls, count;
    char tarcomode;
public:
    // ********************************************************************************
    // Constructor
    // @param flowsignal   The pin which is connected to the flowsensor.
    //
    // change the mode of the tarco
    // 0: Standard One click/rotation
    // 1: FSK modulated 
    // ********************************************************************************
    Tarco(PinName tarcosignal,char mode);
    
    // ********************************************************************************
    // gives the tarco value in hz
    // ********************************************************************************

    float Speed();
    // ********************************************************************************
    // gives the tarco value in rotation pr min
    // ********************************************************************************

    float RPM();
};

#endif