01-21-2016 07:03 AM
Hello everyone,
I am trying to build a code for controlling external devices with the click of a Pedal "Joystick". Basically, this is a simple USB Pedal, which has one button, and can be pressed sequentially, and used as a control. It's a standard device, even don't know the brand.
My goal: I want to configure this Pedal in such a way that, by pressing it, and holding for 1 second, it will trigger a photo capture from a camera. Same Pedal, though, also will trigger another device control, this time by holding it 3 seconds. I would like to make the code in such a way, that it will be able to distinguish between the button pressed duration. After release of the Pedal, I would want it to return to initial state, and if I press for 1 sec. again, to trigger the Camera process again.
I am using the Acquire Input Data VI to configure the Pedal, and am trying to figure out in my mind, how can I implement properly the Delay functions with Logical elements.
Does anyone have experience with such a system? Will be forever grateful for some tips and help!
Bests!
Solved! Go to Solution.
01-22-2016 05:57 AM - edited 01-22-2016 05:58 AM
In addition to my bla bla... here's a screenshot of how I am controlling currently my Case structure. The "Zoom In Photo" is the Acquire Input Data subVI from inside. Anyone knows how to mak 1 sec. press to be recognized as one Case, and 3 sec. press as other Case?
02-03-2016 03:31 AM
Hello pr07ec70r,
you will need to deal with this using a timer. Some example solution is below. Your VI will need to have one loop, that will read continuously (once per 100ms?) the button press, and feed this value to the second loop, that will evaluate the result (even local variable is OK for this). Or you can do this in one loop... depending on what you want to do and how...
02-08-2016 12:55 AM
Dear Jozef,
Thank you so much for the time, and for the useful tips! I've just read your post, will start working on the implementation now, and hope to have some results soon, for sharing. 🙂
Bests,
Al
02-10-2016 03:50 AM
hey Jozef,
Thanks a lot for the amazing solution! It works exactly the way I imagined it, and the most important, it's super simple! Thanks a lot!