|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Methods for Single Button Swapping
Hi guys! So, in my last post in here I posted a swap drive that I wrote. In it I allowed for a single button to be used to swap between modes. Of course, this could cause an issue because the loop normally runs faster than a person can quickly press a button. So to account for this I put a timer in that resets only when it allows the mode to be swapped after a certain period of time. I was just wondering, are there another other, more simple ways of doing this?
|
|
#2
|
|||||
|
|||||
|
Re: Methods for Single Button Swapping
Remember the state of the button the last time you checked it. If it is currently pressed but was not pressed before, then do the swap. Otherwise do nothing.
|
|
#3
|
|||
|
|||
|
Re: Methods for Single Button Swapping
For now the question is about a button but, this leads to other questions about how to handle systems with change of state. Time to look into state machines. Two concepts that are very important to robot programming real time and state machines. We formally teach these concepts to our programming team.
|
|
#4
|
|||
|
|||
|
Re: Methods for Single Button Swapping
I believe the attached VI is suitable for what you are looking for.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|