Count analog pulses


hi
i want count pulses energy meter,
when loop , read sensor, can count pulses
but how count pulses within time period eg. minut save sum variable?

/trident

quote
but how count pulses within time period eg. minut save sum variable?
use blinkwithoutdelay principle using millis() timing.

save millis() value @ time start action happens.  then, each time through loop(), check whether required wait period has elapsed subtracting start time millis() value now.  if period has elapsed act accordingly , maybe save start time next activity.  if not, go round loop() again, taking other actions and/or reading inputs such adding 1 count each time input goes high, don't block free running of loop().


Arduino Forum > Using Arduino > Programming Questions > Count analog pulses


arduino

Comments