LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with writing to file and LED response

I am trying to make a VI that will tell me, based on the conditions I have assigned in the MATLAB script, whether or not the buttons that were pushed on the front panel were simultaneously pressed or not (as indicated by an LED) and save the data about when each button was pressed to a folder. The problems that I am facing are that the LED is not operating how I want it to, I have tried using the OR Array Elements as well as the AND Array Elements. Additionally, there is a flaw with the set up I have to write the pressed button data to a file, it creates a file in the folder but I cannot open it and it does not seem to have a specified file type. Attached is a screen grab of my VI.

Thanks!

0 Kudos
Message 1 of 3
(2,587 Views)

Your file is called "desired folder" which means it has not extension, and probably gets put in a default directory somewhere.  Try giving it a better filename with an extension such as .txt so that it would then open in notepad.

 

I think your logic up top is all wrong.  Your event structure is going to wait to execute until you get a button press, and that value will be the time difference since the VI started.  All the other array inputs are going to be zero.  Nothing there relates to other buttons.

 

If you want to see if buttons were pressed at the same time, (or probably more like nearly the same time) use the Time node in the event case to capture when a button is pressed.  Do that in a loop until perhaps some short amount of time has passed.  Store up all the time values there that you get and see if they are all within some tolerance of each other.

0 Kudos
Message 2 of 3
(2,564 Views)
Hi,

There is so much wrong in your VI...

Remove all coercion dots! This will get rid of some problems like tor code testing the ss value...
Use a proper file path! You want to create a file named "desired folder" without any file extension?
Using a lot of "default if unwired" tunnels might impose problems too!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 3
(2,563 Views)