LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set Cursor Position Continuously

Hi,

 

This program needs to control the cursor in the x-direction (left and right) and the y-direction (Up and down). The data is being acquired via a DAQ and accelerometer. Hence, if I tilt the accelerometer left/right, the cursor should move left/right--same as up and down.

 

The set cursor position library function does not seem to allow me to do this. I know I will also need to add some boolean structures and other things, but I am overall unsure if the set cursor position is the best function for me to use. Any suggestions?

 

Thanks

0 Kudos
Message 1 of 14
(5,792 Views)

When you say Cursor, do you mean the cursor for the chart or the cursor of the Windows?

 

Waveform chart has no cursor.  Use a graph instead.

 

George Zou
0 Kudos
Message 2 of 14
(5,771 Views)

Hello,

 

Sorry, I should have been more clear. I need to control the actual windows cursor, not just the cursors that you can set up on waveform graphs. 

 

Thanks

0 Kudos
Message 3 of 14
(5,755 Views)

Are you sure that's a good idea?  Taking control of the main way to interact with a computer seems to be a very bad thing to me.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 14
(5,738 Views)

Hello,

 

It is for potential applications for people with paralysis from the neck down. Do you have any suggestions?

0 Kudos
Message 5 of 14
(5,731 Views)

It is easy what you want to do in LabVIEW, see this previous post about it:

https://forums.ni.com/t5/LabVIEW/How-to-control-mouse-cursor-using-EEG-signals/m-p/3211341/highlight...

This gives you an example, but of course you need to alter it to fulfil your current needs. Note that, you must program a key combination (in the example it is ctrl+shift+Q) so you are able to stop the VI executing, you cannot use your mouse in this case naturally 🙂

 

edit: the example is a png snippet, you can drag&drop into a block diagram and you get the VI too...

0 Kudos
Message 6 of 14
(5,713 Views)

Ok, I just had a look at your VI in your first post. As I see you are quite a beginner in LabVIEW. You miss the basic principle of dataflow too. You have your positioning library call OUTSIDE the while loop, it will only execute when the while loop finished iterating.

 

Other big problem is that you need at least 2 parallel while loops here. One for the DAQmx (you also set up this task in a wrong way, see the shipped DAQmx examples with LV!), and another loop, a "consumer loop". So you need to acquire data, send it via a Queue to a consumer loop, where you do your data processing + mouse cursor positioning. I guess later you also want to simulate programmatically mouse clicks...?

 

I suggest you to start learning LabVIEW, at your current level this is going to be too painful. Check if you have access to online material Core 1-2 (and 3)?

Also have a look the DAQmx Producer/consumer examples.

http://www.ni.com/example/31192/en/ 

0 Kudos
Message 7 of 14
(5,699 Views)

@Paige5 wrote:

Hello,

 

It is for potential applications for people with paralysis from the neck down. Do you have any suggestions?


Oh!  In that case, it's a very good idea.  I'm hoping that we can help you get this project going.  🙂

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 14
(5,671 Views)

Hi,

 

Thank you, this is very helpful. Why are you multiplying by 1024 and 768? I assume this is for sampling purposes? Also, I have attached a screenshot here. I want to only read in values from the index array if the value differs from the threshold, but the boolean value will only be 0 or 1. Is there a way to use a comparison function without immediately outputting a boolean value? 

 

 

I know these are simple questions, but I am doing my best to learn and appreciate your help. Thanks!

 

Setcursor.JPG

0 Kudos
Message 9 of 14
(5,645 Views)
The code in the screenshot you show, does not make any sense. If you just throw together different VIs in an ad hoc way, it will not work. People can much more easily help you, if you start to learn LV. You still do not understand basics in LV programming. Spend a couple of weeks learning the online courses "Core 1" and "Core 2".
If I help you at this point, it will not make any difference, since you will not understand how the code works. And i am not here to do your work, but can help/guide you through the learning curve, as my little free time will let it do.
0 Kudos
Message 10 of 14
(5,630 Views)