eddiemerckx Posted November 11, 2010 Report Share Posted November 11, 2010 Hi guys, I'm designing a robot which turns on a base. To determine the position it's in, I use a button (NI-DAQ) which is pressed every few second. Now I want to count the amount of button presses. I have the a DAQ-module (which reads the inputs) running in a while loop. When I increment a counter using a case-structure when the button is pressed, my increment is repeated every clockpulse. I tried using an Event structure to execute when the boolean changes its value but that didn't work. Using a second boolean as control to stop the incrementation didn't work well either. Any ideas on how to do this? Quote Link to comment
Ryan Podsim Posted November 11, 2010 Report Share Posted November 11, 2010 Sounds to me like you need to implement a SR(shift-register) in your while loop to hold the last value of the Boolean in question and do a comparison between the boolean in question it's previous value. Example Quote Link to comment
eddiemerckx Posted November 11, 2010 Author Report Share Posted November 11, 2010 Sounds to me like you need to implement a SR(shift-register) in your while loop to hold the last value of the Boolean in question and do a comparison between the boolean in question it's previous value. Example Thank you Ryan, while loading this topic, I came up the a similar solution involving a shift register and a control boolean. This seems to work. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.