04-15-2013 11:54 AM
Hello
I'm using an accelerometer+gyr with Arduino uno, the issue is, I obtain the data through VISA, so far, without problem.
The problem is, Arduino sends 6 different data, from the accelerometer, and my propose is, it separates the different data to work with it. (6 different values from the axes). The arduino code is the following:
...
Serial.print(value1);
Serial.print(",");
Serial.print(value2);
Serial.print(",");
...
Therefore I obtain in the serial port something like this: number,number,number,number,number, number
I attach the program in LabVIEW that I did, with "Match Pattern" I separate the string that I get with the Serial Visa, but now I want to insert the different numbers into a Array. Any idea?
Thanks!!
04-15-2013 12:22 PM
Search for a pattern, separate your substrings and convert your elements to numbers. Build an array. I think this is the easiest way.
Tips: try to clean-up the diagram, your code has several backward-wires, what goes against the g flow principle. Avoid coercion dots, like the one in the "VISA Close" block.
04-15-2013 12:31 PM
Use Spreadsheet String to Array. Set the delimiter to a comman and make the array type a 1D array of numbers. Done!
04-15-2013 12:35 PM
Follow crossrulz steps. Guaranteed success.
04-15-2013 02:56 PM - edited 04-15-2013 02:57 PM
Sounds like a great place to use one of my favorite hidden vis.
That AdvancedString folder has quite a few gems in it
04-17-2013 07:26 AM
Hi again
Firtsly, thanks joaopam, crossrulz and Jeff Bohrer.
I attach the new diagram with Spreadsheet String to Array. So, to separate the different data obtained (X,y,z...) I've used Split 1D Array, because, I have to work with each parameter (Math operations, graph...). Do you think that this way is the best? It would be better If I use other loop for the operations with the different paramerts?
joaopam, you are right, thanks for the tip 🙂
04-17-2013 08:18 AM
I don't see the point in your FOR loop. Why not just act on the array coming straight out of the Spreadsheet String to Array?
04-20-2013 08:24 AM
I tried to do without the Loop, however I only got the first part of the string before the first comma. Anyway I will take a look again to figure out why happen that.