Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Sequential control of an 1-button joystick pedal device

Solved!
Go to solution

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!

0 Kudos
Message 1 of 5
(4,357 Views)

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?

 

Untitled.png

0 Kudos
Message 2 of 5
(4,327 Views)
Solution
Accepted by topic author pr07ec70r

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...

code.png 

Jozef Lipták
Message 3 of 5
(4,212 Views)

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

0 Kudos
Message 4 of 5
(4,170 Views)

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!

0 Kudos
Message 5 of 5
(4,132 Views)