Button Read Optimizations

TBC the method in #6 needs the delay. Not sure I feel any better about it finding that it was introduced to fix an observed problem.

In my adjustment, shall we say, to that struct class object, there is no need to delay().

There is no need to delay reporting that the button went down.

And a short button press is fine and recognized after the debounce interval. No need to filter "too short", buttons do not bounce closed or open capriciously, they always do it in the context of getting to a final stable state.

I only added messages and removed delay(). Imma call that an improvement, and this is a struct class object that can and will be useful to me.

I do not have much experience with the struct class object thing, I like how it works and is used here. I appreciate the opportunity to learn about them in these fora, and here in this thread, and I hope my injection of some things I have learned about debouncing are useful.

BTW what do you call it not "struct class object" when you along about such things?

a7

1 Like