Interface to a standard tarco sensor. Measure the periode and the cal the speed
Tarco.h
- Committer:
- gert_lauritsen
- Date:
- 2013-11-20
- Revision:
- 6:2ad5029f7b1a
- Parent:
- 5:451dd1189b0f
- Child:
- 7:752b8065ce2d
File content as of revision 6:2ad5029f7b1a:
#include "mbed.h" #ifndef _Tarco_H #define _Tarco_H #define TarcoRunMean 50 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[TarcoRunMean]; //running mean for tarco Timer t; //time for one rotation Timer fsktime; //time between fsk pulse int pulsvariation, lastpuls, count; char tarcomode; float lastfrekvens; int lastperiode; 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