From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

joystick relay control usb 6009

I have a USB- 6009 DAQ , A Microsoft sidewinder 2 joystick , and several relays/  Using these I would like to get some sort of robotic arm control.  Ive wired the robotic arm so that once the relay switch closes it should begin to move using an outside power supply.  The relays operate at 5V.  At this point ive used the initialize joystick function- my idea was to use the axis values to see if there's a change and if there was it would trigger an value change event case thus leading to another check-seeing if the joystick motion was greater than 1000(arbitrary I thought it was a good motion point).  

 

When I run the VI it never registers an event, this may because I have not used a event reference but im not sure.  I thought if i ran the vi and moved the x-axis it should output the 5 V.  Right now its connected to a voltmeter and is not responding.

 

My questions are

Any reccomendations on how such programming should be done?

Why does my idea fail?

Any suggestions? 

Ill appreciate any and all help I can get as I am just now starting to get a grasp on Labview

Thank you

0 Kudos
Message 1 of 13
(2,945 Views)

A couple problems with your code.

 

1.  When a value is sent to a terminal of an indicator or a local variable of an indicator, it does not fire the value change event.  You would need to wire to the Value Change (Signalling) property node of that control or indicator.

 

2.  Your lower event structure is inside out.  The event structure will only run once.  The event structure should be inside the while loop rather than outside the while loop.  You don't need a timeout case because the event structure will never timeout since nothing is wired to the timeout node.  When you flip is right side out.  You should have another event case that handles the stop button.

0 Kudos
Message 2 of 13
(2,941 Views)
Thanks for your time
Im having a hard time grasping the concept of the property nodes.  Is it possible for you to re-explain the 1st problem you mentioned the wiring of the value change property node?  
 
I will be editing the program today and will attach any changes I make later.
 
Thanks again 
0 Kudos
Message 3 of 13
(2,918 Views)

At this point Im still not getting a value change...

I m not sure how exactly the value signal property node works.  Ive read some websites on this topic but none seem to explain the property nodes usage clearly.   

0 Kudos
Message 4 of 13
(2,906 Views)
A 'value change' event is triggered when the user changes the control value on the front panel.  If you change the value progamatically, through a local variable or property node: value it does not trigger the event.  However, a property node: value signaling acts like a usre value change and triggers the event.  If you want to trigger your event, you need a 'axis info.X axis' property node with a value change signaling when you write the value.
0 Kudos
Message 5 of 13
(2,899 Views)
I stuck the property nod in your VI.
0 Kudos
Message 6 of 13
(2,895 Views)

Thanks for the help. Probably shouldve mentioned before hand that I am using labview 8.5 and cannot open lv 8.6.  

 

0 Kudos
Message 7 of 13
(2,892 Views)
0 Kudos
Message 8 of 13
(2,882 Views)

Ive now done several edits with all of your help and I believe the logic is going correctly.  When I run the program it goes and does not enter the event until I move the joystick .  However when I do move the joystick and enter the loop it does not broadcast the 5V digital output that I want instead I get this error message

 

Measurements: Write cannot be performed, because the number of channels in the data does not match the number of channels in the task.


When writing, supply data for all channels in the task. Alternatively, modify the task to contain the same number of channels as the data written.


Number of Channels in Task: 1

Number of Channels in Data: 16


Task Name: _unnamedTask<C> 

 

Does this mean I have to create several channels? If so is that done through Max or the create task viin labview?  I think this is the last error I need to solve...hopefully.

 

thanks again 

0 Kudos
Message 9 of 13
(2,873 Views)
Your conversion from the Boolean to the data written to the DAQ Assistant is wrong and causing the error. The output of Boolean to (0,1) is an I16 so the Number to Boolean Array creates an array with 16 elements. Just wire a Build Array to the Boolean input and wire the output of this to the DAQ Assistant.
0 Kudos
Message 10 of 13
(2,868 Views)