10-05-2017 01:39 PM
Hello all,
I am new to the Labview software and am trying to make a program using the software that graphs a joystick's Y axis inputs onto a graph in the program. I would like the x axis to represent the time elapsed since the program started and the y axis to represent the position of the joystick. Can anybody point me in the right direction to start? Thank you. (I am using a Thrustmaster joystick)
10-05-2017 02:02 PM
There is a sub vi in LabVIEW that could get you the coordinate info of mouse/joystick, and you can plot the y axis with time. Just search "mouse" in the example.
10-05-2017 03:21 PM
Joysticks are a little different from Keyboards and Mice, but have a set of VIs that are lumped with these two input devices. If you Google "LabVIEW Joystick", you'll fine a VI that shows how to set up a Joystick and take a single reading. You will probably want to add a While Loop with a Wait Timer to take multiple readings and graph them.
Note that not all Joysticks will show up in LabVIEW. There's a suggestion on the LabVIEW Idea Exchange here that I posted about 5 years ago and reposted last year when not enough people "Kudo-ed" it to nudge NI into fixing this problem. If you intend to use joysticks, I recommend you read the Idea and Kudo it.
Bob Schor
10-05-2017 04:59 PM
Do you have problems reading the joystick, or problems graphing the data, or both.
10-05-2017 05:51 PM
the program is reading the joystick inputs, I am having trouble graphing this data as a function of elapsed time
10-05-2017 06:55 PM
If the points are randomly spaced in time, you probably want to use an xy graph and build the xy data (e.g. as a complex 1D array) in a shift register. Do you want absolute or relative time? What is the max number of points?
10-05-2017 11:05 PM
You should post your code (attach the actual VI, not a picture). Did you read my post, where I said "You will probably want to add a While Loop with a Wait Timer to take multiple readings and graph them."?
Bob Schor
10-11-2017 03:02 PM
Here is a file of my current VI. The VI can read the input data from the joystick, but it is unable to plot the data in a graph! any help is appreciated thank you
10-12-2017 03:49 PM
You "Build xy graph" express VI is configured to "clear data on each call", meaning it will never graph more than one point, and since your plot style only shows lines (not points!), nothing can ever be drawn. Double-click the express VI and un-check the option.
10-13-2017 03:28 PM
I don't know whether to "blame" NI for inventing Express VIs or Instructors who don't caution students "Do Not Use An Express VI until you understand how to do without it!". Yes, they look simple, and are designed so a LabVIEW Sales Engineer can show "how easy it is to get started collecting data in LabVIEW", but they cover up a multitude of sins. Of course, reading carefully the Help documentation and poking around in the corners before slapping down the "simple answer" also would help ...
Bob Schor