Quote Originally Posted by cncmachineguy View Post
you intended to right?

I thought you were just giving us new folks a chance to help Better to teach than to do. that way we learn something.
Nope, I made one of my many mistakes. I was planning to give the OP a basic working code like I just did for something to "start" with. Then if needed try to do a little "teaching".

Seems like a simple operation, but to make it work well some sort of de-bouncing and maybe an interrupt will be needed.