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

Committer:
gert_lauritsen
Date:
Sun Oct 27 12:12:53 2013 +0000
Revision:
1:f5d3c37b065e
Parent:
0:8421e11df32a
flow v?rdi skulle lige sende i float og ikke int;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gert_lauritsen 0:8421e11df32a 1 #include "Counter.h"
gert_lauritsen 0:8421e11df32a 2
gert_lauritsen 0:8421e11df32a 3 Counter::Counter(PinName flowsignal) :
gert_lauritsen 0:8421e11df32a 4 _flowsensor(flowsignal) {
gert_lauritsen 0:8421e11df32a 5 Count=0;
gert_lauritsen 0:8421e11df32a 6 _flowsensor.fall(this, &Counter::click);
gert_lauritsen 0:8421e11df32a 7 }
gert_lauritsen 0:8421e11df32a 8
gert_lauritsen 0:8421e11df32a 9 void Counter::click() {
gert_lauritsen 0:8421e11df32a 10 Count++;
gert_lauritsen 0:8421e11df32a 11 }
gert_lauritsen 0:8421e11df32a 12
gert_lauritsen 0:8421e11df32a 13 float Counter::Flow(){
gert_lauritsen 1:f5d3c37b065e 14 return (float) Count/PulsPrLiter;
gert_lauritsen 0:8421e11df32a 15 }
gert_lauritsen 0:8421e11df32a 16