06-14-2011 07:25 AM
Hi there,
I am currently developing a piece of software which needs to take in data from an Arduino board via the serial port and parse the input accordingly.
I have the 2 pieces of code working perfectly well separately, but I can not seem to figure out why they are not functioning properly together.
Just now, the input is being retrieved fine and passed into the Scan string for tokens method, but it is not being split on the tokens, it is just outputting the string as a whole.
The input is in the form of 1:0 2:0 3:1 etc. so I am trying to split it on any spaces found. If I attach a string to the Scan strings for tokens it works fine, just not when I am attaching the data from the serial port to it.
Any help would be appreciated.
06-15-2011 01:47 AM
Hi,
In the output which you are getting from the serial port, is there space between 1:0 and 2:0 and 3:1? If there is no space between them, then it wont be able to scan for tokens and will output the whole string. I don't have the hardware here and so don't know what exactly is the output which you are receiving. Try to see in the read buffer indicator whether the tokens are seperated by a space or not.
I have attached your vi after adding a small part in it. If the problem is with the spacing then this will work fine for 1:0 2:0 3:1.
Regards,
Nitzz
(Give kudos to good Answers , Mark it as a Solution if your problem is Solved;))