Thank you for your reply Fettkeewl -
I think I understand what you mean by “editing” my post … you removed many of the comment lines just to make the code a little more compact. I do not see an “edit” button however …
That is not really critical … just to be clear however, I do use the “preformatted text” formatting tool when I paste code into my topics.
Back to the issue … Yes, I understand that global variables are to be declared outside of the function. All of my variables are declared in the beginning of the sketch, outside of any function including the setup(). I did remove the “int” prefix when resetting the variables just in case that caused some confusion and perhaps declared the variables again within the function. That has no effect.
Somehow the revCounter variable within the second timer which is called by the first timer.setInterval is the issue. I can change the sketch to not reset the revCounter variable in the calling function and the value is passed correctly. However that does not give me a proper count for the time frame I am checking … it just continues to increase and is not reset to “0”.
I think that when the “timer.setTimer” function finishes its cycles … it still goes back to the calling function and resets the variables before the data is sent to Blynk. I can’t think of a way to set them back to zero when calling the first “timer.setInterval” function and not have them reevaluated before the data is sent to Blynk.
The question is … can you think of another way to count the revolutions for a fixed period of time within a function that is called by a timer.setInterval(). I cannot use “delay”, and a simple count down variable goes so quickly at the speed of the processor. The other thought I had was to use a millis counter within the “while” loop to slow down the reading of the pin status on the MKR1000 processor.
See the prior post for the code …