Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

joystick input to generate digital output using NI6009

hi, i am using the NI USB-6009. i want to ask how do i read analog input from joystick(in voltage) and generate digital outputs based on the input read to control switches. P.S. for my case, 'forward', 'backward', 'left', 'right' are four different wires where 5V is generated when the joystick is moved to that position.
0 Kudos
Message 1 of 6
(4,395 Views)
Hi Deimon,

Thank you for posting on the National Instruments forums.

If you are using LabVIEW, there are several examples in the Example Finder that will assist you in creating your application.  You can get to the Example Finder by clicking on Help and then Find Examples… 

First, you can use the example Cont Acq&Graph Voltage-Int Clk.vi to read what the value of each channel is.  You will probably need to change the Physical Channel to Dev1/ai0:3 so that you are reading from all 4 channels at once.  You will want to make sure the DAQmx Read is set to read multiple channels.  You can then create logic that when you read the voltage from the channel, will change the output on a digital line to be high by using the code from Write Dig Chan.vi or Write Dig Port.vi.


If you were doing something else like creating a pulse train when you read a certain voltage on your input, then you can use another example instead of Write Dig Chan.vi.  There are many examples in the Example that can help you out in this aspect.

Thank You,

Nick F.
Applications Engineer
0 Kudos
Message 2 of 6
(4,367 Views)
What if A USB joystick is used instead? Does a USB joystick give out analog or digital output? Then how can the outputs given used to like program the NI - 6009 to give out the voltage it need according to the different channels?
0 Kudos
Message 3 of 6
(4,332 Views)
Lets keep your question to the original thread you created.
0 Kudos
Message 4 of 6
(4,321 Views)

Thanks Nick,

                      however if i'm now using a USB joystick.. What am i suppose to do? how can i like control the output given out form the joystick to control the NI USB 6009? and ya.. is the output given out from the joystick digital or analog outputs??  Thanks...

0 Kudos
Message 5 of 6
(4,302 Views)

Deimon,

Look at the thread in my message above. You use the Acquire Input Data function to read the joystick. There are cluster outputs for direction info and axis info. You will need to take those results and translate them into the correct DAQmx Write functions.

0 Kudos
Message 6 of 6
(4,288 Views)