sample and hold

Running Total with Sample and Hold?

ginsu777's picture

I have been trying to take a single sample every 15 seconds from a number I am calculating and then display as it increments every minute - only incrementing when it gets to the next whole number. The reason for this confusion is that the number is calories/minute based on a heart rate that is sampled every 2 seconds. So I only want to calculate and store and augment the number every minute.

In any event, I tried the INTEGRATOR patch, but it seems to go haywire adding things up fast. I also tried different multiplexers and triggers but with no luck.

Any ideas how to calculate and display a running total sampled from a stream of calculated numbers? Side issue: rounding. The numbers calculated are usually like 0.0254689 every 2 seconds I dont even want to count it towards the total unless it reaches something like .20 or .30

The included example wont work unless you can input some numbers on the serial port or replace the serial thing with some numbers of your own.