05-29-2013 08:48 AM
Hi, I have the attached vi where I am reading in Bluetooth data, plotting and saving the data. My inner while loop is the one performing the plotting, where I have the error out of the Bluetooth Read function wired to the boolean control of the loop. If for some reason the connection gets distrupted, the loop exits and the BT automatically reconnects. The problem here is that one the inner loop stops, the graph plotting the data clears. I am looking for a way to keep the data plotted on the graph, so once the connection is lost and reconneted again, the data continues plotting from where the connection was lost. I cannot figure out how to do this, I tried to use local variables to plot the data outside the graph while the loop is running but that didn't work. Can somene provide me assistance?
05-29-2013 09:24 AM
I included a small check, and I think it should work now...!!
05-29-2013 03:30 PM
Hi, thank you, and sorry for the messy code :), I usually don't clean it up until the program is written. I am referring to the graph which is highlighted in yellow however (attached). It clears once the connection is lost, i.e. inner while loop stops. I need to keep this data on the screen always.
05-29-2013 04:35 PM
why 2 while loops?
05-29-2013 05:50 PM
This seems eerily familiar...http://forums.ni.com/t5/LabVIEW/Couple-of-questions-regarding-displaying-and-saving-data/td-p/242817...
If I remember correctly, you have this loop duplicated to talk to another Blue Tooth device. What you really need to do is set up a Queued Message Handler. You have one main loop accepting commands from the user. Commands would be to start acquisition, stop acquisition, close program. There might be more, but that would be the obvious ones. There can be different buttons for each device. You can then send commands to your other loops via queues or notifiers. This would also add the benefit of not having a loop that runs forever and being forced to use the Abort button in the toolbar.
05-29-2013 11:39 PM
My bad...!!
I was working late night and misinterpretate "Write to File" express VI with "Build XY Graph" express VI..!!
Anyways the attached code should work fine.
05-30-2013 10:12 AM
Hi thank you, this is what I am looking for. As it stands, when the inner while loop is stopped, i.e. no incomming data, the graph is still plotting zeros vs time due to the outer while loop running. I am looking for a way to not plot these zeros and the real time while the inner loop is stopped. I can not plot the zeros by sending sqrt of -1 (NaN) to the graph if the data is equal to zero, but the x-axis (time) is still plotting real time. How do I hault the time axis plotting?
I cannot remove the outer loop because of crossrulz reference to my previous post on multiple bluetooth connections, each one needs to be in its own loop for them to work all at once, I have already tested this.
05-30-2013 10:58 AM
@moderator1983 wrote:
My bad...!!
I was working late night and misinterpretate "Write to File" express VI with "Build XY Graph" express VI..!!
Anyways the attached code should work fine.
Here, I took care of some of your Rube Goldbergs.
I'll try to get something written up to show a Queued Message Handler...
05-30-2013 11:46 AM
Ok, it is actually a form of the Master/Slave, but the concepts are basically the same. You have a different loop for each device you have to connect to. Each loop gets its own notifier. You have another loop with an event structure to be able to control who is running when. Also notice that there is a stop button. You use that to stop your program instead of using the Abort VI button. It is best to clean up instead of just aborting.
05-30-2013 11:51 AM
Thanks for this crossrulz. I cannot open your code as I am running 2010, 10.0.1. Can you resend so I can open it?