Hmm. Ok, let me see if I can word this better. Sorry about that.
First your question: Likely can't. I've tried declaring it locally, tried making it a parameter, but I can't quite figure out what I'm doing wrong.
Second: Behaviour
Right now if you leave that nested if statement in the loop the pot functions the way I need it too. It sends the proper value only when you are turning it. When its resting nothing gets sent. Its just silent.
If I move that "debounce" (or threshold) into the function, then call the function in the loop, it'll return whatever values I tell it too, but I will loose the desired behaviour of the pot being silent when its not being turned.
So I guess my questions are:
- Is there a way to move that if statement into that function, while still maintaing the "silent while not being turned" behaviour?
- How can I write this to be re-useable for multiple pots?
I hope that's better? I find forums sometimes difficult to outline stuff in. But I appreciate the extra set of eyes and feedback.