04-16-2018 12:18 PM
Hello,
I am having trouble reading data on Elegoo UNO. I am getting correct data on the buffer but I want to capture those specific set of data on the table. Can someone help me please? I am having trouble with this.
Please, loop at the VI.
Thank you!
04-16-2018 01:19 PM
What does the data look like coming out of the Arduino? I am guessing that you are also programming the Arduino so I suggest you send the data out this way.
Serial.println(x","y","z)
That will send x, y, and z in one line separated by a comma and end with a carriage return.
Then use "Scan from String" to get the values out of the string.
04-16-2018 02:41 PM
Arduino is programmed like:
Serial.print(a.x());
Serial.print('\t');
Serial.print(a.y());
Serial.print('\t');
Serial.print(a.z());
Serial.print('\t');
This prints x, y, and z with a tab.
What is Scan from String? How would I use that? Can you please provide an example?
Thank you very much for taking your time.
04-16-2018 03:20 PM - edited 04-16-2018 03:20 PM
04-16-2018 03:32 PM
Hello, will this matter if the value gets really big or changes really fast?
Will the coma always separate the values not mattering the size of the string?
Thank you so much!
04-16-2018 03:35 PM - edited 04-16-2018 03:38 PM
Nope won't matter.
You might want to wire in a "default value" and consider error handling so it will not just crash in case you get bad data.
04-16-2018 03:47 PM
Thank you so much!
I will test everything. Hopefully this is enough.
04-16-2018 06:27 PM - edited 04-16-2018 06:27 PM
Another question.
What if you are trying to read more than 3 parameters?
Say x,y,z, and temperature?
Thank you!
04-17-2018 09:10 AM
Just add it in to the data you are sending and right click on "Scan From String" and select Edit Scan String and add another operation to get the next vale out of the string.