Split node

hi,
i have 2 ultrasound sensors working with arduino.input is the rs232 node
one is sending an A signal the otherone a B signal.
is there a way to split this incomming signal.
I know that there is mr.benefits node, but as long as I am just using 2 sensors I wont programm seros for the other incomming signals.

what is your arduino sending over the line?
The Separate, Split or RegExpr node will help you?

arduino is sending

a1923 b1234

so i have to split them up into a and b signal…

but how, i do not know how to set up the regexpr?

You could try

Seperate (string) to make it a 2 slide spread, and thean CAR (string) to get ‘a’ and ‘1923’, and finaly you can use AsValue (String) to convert the text ‘1923’ to the Value 1923.

Good luck ;)

if there is a space between the last number of “a” and “b” just use separate(string) and set the intersperse pin to “Space”.
if not this regular expression might do it:
a(.?)b(.?)$

thanx for all the help. its now working:

RS232 > seperate > CAR > 2 x AsValue > 2x MapRange

nice :-)

lets see what we can do with it…

My Arduino experience is that the incomming string isn’t always 100% clean/the same, how did you solve that? I can imagine a small delay somewhere… but can you share that secret with me?

And in the end I would do a Change (animation) and S+H (animation) to always hold the last incomming value, or when it actualy changes… (but you already know that I am sure ;) )

@bjoern, is the RegExpr syntax based on something, so I can read up on that, cozz that node looks very powerfull, once you understand it proper…

hmm, everything I know about regular expressions I´ve learned from the helppatch:) but there is the FAQ on RegExpr (String) which goes very much into detail.

b

They key to have 100%error free transmission is understanding that the commands which get sent in one bunch from the arduino are not guaranteed to arrive in vvvv in the exact same frame. depending on the speed of both computers there might be one message, two or more messages, or half messages received.
To solve that problem vvvv has the Tokenizer (String) node, which allows queuing up received messages until they are complete and then delivering them one by one (or as a spread). Make sure the arduino sends something like a message end character after each message (usually a carriage return 13, but it can be anything) and make the Tokenizer split after that characters.
Not using this technique will always lead to spurious random glitches with their probability depending on a lot of factors…

@ Bjoern: And there we have another Wiki I didn’t knew it excisted, thnx for that link!!

@ Oschatz: This is the most usefull information I read in Weeks!! Never looked at the problem like that. Don’t have much experience in recieving stuff in vvvv. So I thank you, and I bookmarked this thread :)

You people are great and kind!!